-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Paths should be sorted like strings #152
Comments
Yes, this is intentional, for two reasons.
|
Thanks for the clarifcation Seth! |
Hmm... I'm confused. "10" should follow "1", and also for the example values you provided the default sorting and % python
>>> x = ["/a/b/1/something", "/a/b/2/something", "/a/b/10/something"]
>>> sorted(x)
['/a/b/1/something', '/a/b/10/something', '/a/b/2/something']
>>> import natsort
>>> natsort.natsorted(x)
['/a/b/1/something', '/a/b/2/something', '/a/b/10/something']
>>> natsort.natsorted(x, alg=natsort.PATH)
['/a/b/1/something', '/a/b/2/something', '/a/b/10/something']
>>> natsort.__version__
'8.1.0' Perhaps you could elaborate more on the problem you actually encountered? Also, to be clear, |
Interesting, it seems the issue lies with using
This matches my case since I was sorting the output of |
Ah yes. This is expected but surprising behavior (see #16 for someone else suggesting something similar). The suggestion in that issue was to auto-use However, auto-converting
|
Closed by #153 |
Hey there,
Thanks for the great package!
I was wondering why ns.PATH isn't on by default when using
natsorted
.It would seem intuitive that a list of paths would be naturally sorted, and actually had to debug to realize I need to use
os_sorted
ornatsort(files, alg=PATH)
.Is this intentional?
If not, I'd be happy to submit a PR
The text was updated successfully, but these errors were encountered: