Ranter
Join devRant
Do all the things like
				++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
				Sign Up
			Pipeless API
 
				From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
				Learn More
			Comments
		
- 
				
				You can always sort the keys in some other data structure. Why is it a problem?
 
 In addition dictionaries are supposed to work 'like' hash arrays and since hashes are not ordered neither are keys in dict
- 
				
				@kpenc Python has said that this is not a feature, just a side effect of something they did to make dicts more compact. They said, and I quote, "The order-preserving aspect of this new implementation is considered an implementation detail and should not be relied upon"
- 
				
				
- 
				
				 kavenc6319ySo there are people ranting about why there was only ordered map before C++11. Just find that interesting. kavenc6319ySo there are people ranting about why there was only ordered map before C++11. Just find that interesting.
- 
				
				@mojaveazure yeah, thats what i use. But in another part of my code i wanted to rely upon the index of the key, ya know - flat data structures are nice.
 Btw: you can even ditch ".keys()" because if you use it as an iterable it automatically returns only the keys.
Related Rants








 No questions asked
No questions asked As a Python user and the fucking unicode mess, this is sooooo mean!
As a Python user and the fucking unicode mess, this is sooooo mean!
Whyyy are dictionaries unordered in python. Fuuuck.
(Yes I know of OrderedDict, no you don't have to remind me - it is not a native data type, it is a module: argument over)
undefined
wk30
python