FluidityProject / fluidity

Fluidity
http://fluidity-project.org
Other
365 stars 115 forks source link

Possible update for method 'sorted_nicely' #324

Closed OshinoMoumou closed 2 years ago

OshinoMoumou commented 3 years ago

Greetings! I noticed that method sorted_nicely referred a StackOverflow post, while a recent comment to it noticed that it doesn't work for sorting sets of version numbers alphanumerically; e.g., v1.0.1, v3.5.3, v3.2.4. I'm trying to learn the usefulness of such small updates on StackOverflow. Would this comment help improve your code? I understand that might not happen in real life situation. In that case, do you think this comment can help prevent future defect (if the code were reused somwhere else)? I'll really appreciate it if you could kindly give me some feedback or suggestions. Thank you very much for your time. Have a nice day!

gnikit commented 3 years ago

Interesting observation. I am not sure why we have our own natural sorting algorithm, probably one of these decisions that was made back in the day. There is a very good, robust package nowadays that takes care of these operations called natsort but I am not sure if Fluidity specifically would benefit from swapping sorted_nicely to natsorted. If we did, we would have to update the Python packages shipped with the docker images, which might be a bit of a hustle.