Hacker News new | ask | show | jobs
by omegote 2687 days ago
I'm not sure what you're trying to imply. If it's regarding the order, you're wrong. The keys returned by either `keys()` or by `__iter__` are returned in arbitrary order [1].

[1] https://docs.python.org/2/tutorial/datastructures.html#dicti...

1 comments

The whole cheatsheet is clearly in Python 3, where the same doc page that you linked states:

   Performing list(d) on a dictionary returns a list of all the keys used in the dictionary, in 
   insertion order ...
only specified as such since Python 3.7, which hadn't been released when this cheat sheet was written, at least if the date at the top is accurate.

EDIT: clicking through to GitHub, the date is clearly not up-to-date, so this might have been added later.