r/ProgrammerHumor • • Mar 16 '20

Sort algorithm

65.4k Upvotes

614 comments sorted by

View all comments

Show parent comments

41

u/Raydan4 Mar 17 '20

Technically yes, but the way that hashing integers works, in standard python, integers are added to sets in order, at least most of the time. Implementations of python like pypy do not have this behavior.

3

u/[deleted] Jul 15 '20

PSA: Please do not rely on this in your code

2

u/Raydan4 Jul 16 '20

Well obviously, that’s not what sets are for