MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/fjk6u1/sort_algorithm/fknq30j?context=9999
r/ProgrammerHumor • u/Hamstorian • Mar 16 '20
614 comments sorted by
View all comments
3.8k
If she's doing bucket sort at this age, then she's set.
776 u/SharkLaunch Mar 16 '20 But sets are unordered 135 u/Raydan4 Mar 16 '20 Except sometimes if you are using python and you have a set of integers 54 u/thegodzilla25 Mar 16 '20 Aren't python sets also unordered though? I dont understand what you mean. 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 → More replies (1) 2 u/capilot Jul 15 '20 Relevant Codeless Code 29 u/Epithus Mar 16 '20 Have you seen toddlers? They are the very definition of "unordered". 119 u/[deleted] Mar 16 '20 Franchises are small businesses. They are lying. 114 u/notusuallyhostile Mar 16 '20 /r/LostRedditors 17 u/BackgroundAmoebaNine Mar 16 '20 Right that's was so unusual it almost seemed perfect. 6 u/interesting-_o_- Mar 17 '20 It’s a bot. All of their replies are complete word salad. 6 u/lambo1722 Mar 16 '20 Stop it 2 u/Botahamec Mar 16 '20 edited Mar 17 '20 They're sorted by hashcodeEdit: It's actually sorted by the value of (hashcode % set.size) → More replies (2) → More replies (3)
776
But sets are unordered
135 u/Raydan4 Mar 16 '20 Except sometimes if you are using python and you have a set of integers 54 u/thegodzilla25 Mar 16 '20 Aren't python sets also unordered though? I dont understand what you mean. 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 → More replies (1) 2 u/capilot Jul 15 '20 Relevant Codeless Code 29 u/Epithus Mar 16 '20 Have you seen toddlers? They are the very definition of "unordered". 119 u/[deleted] Mar 16 '20 Franchises are small businesses. They are lying. 114 u/notusuallyhostile Mar 16 '20 /r/LostRedditors 17 u/BackgroundAmoebaNine Mar 16 '20 Right that's was so unusual it almost seemed perfect. 6 u/interesting-_o_- Mar 17 '20 It’s a bot. All of their replies are complete word salad. 6 u/lambo1722 Mar 16 '20 Stop it 2 u/Botahamec Mar 16 '20 edited Mar 17 '20 They're sorted by hashcodeEdit: It's actually sorted by the value of (hashcode % set.size) → More replies (2) → More replies (3)
135
Except sometimes if you are using python and you have a set of integers
54 u/thegodzilla25 Mar 16 '20 Aren't python sets also unordered though? I dont understand what you mean. 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 → More replies (1) 2 u/capilot Jul 15 '20 Relevant Codeless Code
54
Aren't python sets also unordered though? I dont understand what you mean.
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 → More replies (1)
41
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 → More replies (1)
3
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 → More replies (1)
2
Well obviously, that’s not what sets are for
Relevant Codeless Code
29
Have you seen toddlers? They are the very definition of "unordered".
119
Franchises are small businesses. They are lying.
114 u/notusuallyhostile Mar 16 '20 /r/LostRedditors 17 u/BackgroundAmoebaNine Mar 16 '20 Right that's was so unusual it almost seemed perfect. 6 u/interesting-_o_- Mar 17 '20 It’s a bot. All of their replies are complete word salad.
114
/r/LostRedditors
17 u/BackgroundAmoebaNine Mar 16 '20 Right that's was so unusual it almost seemed perfect. 6 u/interesting-_o_- Mar 17 '20 It’s a bot. All of their replies are complete word salad.
17
Right that's was so unusual it almost seemed perfect.
6
It’s a bot. All of their replies are complete word salad.
Stop it
They're sorted by hashcode
Edit: It's actually sorted by the value of (hashcode % set.size)
→ More replies (2)
3.8k
u/theeggman84 Mar 16 '20
If she's doing bucket sort at this age, then she's set.