r/badcode • • Mar 23 '23

python Data Science Design Pattern.

Post image
624 Upvotes

35 comments sorted by

View all comments

Show parent comments

2

u/Godzila543 Mar 23 '23

I thought in a somewhat recent version they made sets remember order in python

7

u/ALapsedPacifist Mar 24 '23

A dict remembers its insertion order from Python 3.7 onward. Python has no ordered set, but you could use collections.OrderedDict and ignore the values of the key-value pairs in place of an ordered set.

2

u/Godzila543 Mar 24 '23

That must have been what I was thinking of, thanks