Reg something I noticed weird in the jupyter notebook

25 views
Skip to first unread message

Nishanth

unread,
Mar 24, 2023, 3:38:09 AM3/24/23
to jup...@googlegroups.com

Hey there.... This is Nirmal here.... This is not such a big deal but I want you to clarify whether this is a bug or some intentional thing. I am attaching a pic below. Kindly have a look into it and let me know whether this issue with alphanumeric sorting of file names is bug or intentionally done to accommodate some needs.

 

 

Thanks and regards....

 

 

 

 

vishwesh...@gmail.com

unread,
Mar 24, 2023, 3:43:39 AM3/24/23
to Project Jupyter

Hi Nirmal,

This is the normal string comparison behavior in Python. The strings are compared character by character, and if you run out of characters in one string, it is by default assumed to be smaller than the other string. That's why, "M - 1" < "M - 10".
Usually to avoid something like this, the best idea would be to name the folders something like "M - 01", "M - 02", etc.

Jason Weill

unread,
Mar 24, 2023, 1:17:02 PM3/24/23
to Project Jupyter
With the exception of macOS's Finder (see attached screen shot), every file/directory browser I've used sorts files in "ASCIIbetical" order, where "1" < "10" < "2". This could be a plausible enhancement request for the filebrowser, but not something I'd consider a bug. I agree that zero-padding numbers would help with ASCIIbetical sorting.

Jason Weill
finder.png
Reply all
Reply to author
Forward
0 new messages