Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You should sell this to microsoft for millions.


Is it a sarcasm?

It seems that Microsoft's StrCmpLogicalW() has exactly desired behavior. Besides it is trivial to implement:

  def natural_key(key):
      """See http://www.codinghorror.com/blog/archives/001018.html

      >>> L = 'a01 a9 b1 b10 b9'.split()
      >>> L.sort(key=natural_key)
      >>> ' '.join(L)
      'a01 a9 b1 b9 b10'
      """
      return [int(chunk) if chunk.isdigit() else chunk
              for chunk in re.split(r'(\d+)', key)]




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: