[issue18986] Add a case-insensitive case-preserving dict

Ethan Furman report at bugs.python.org
Thu Sep 12 16:34:57 CEST 2013


Ethan Furman added the comment:

True, but how big a deal is that?

For one, it seems questionable to have the presentation portion of the data be part of the key.

For two, when presentation is important a separate list must be kept anyway to preseed the dict; so just use that list to cycle through the canonicaldict:

--> some_dict = some_function_that_returns_a_conanicaldict()
--> presentation_list = ['IBM','Intel','AMD']
--> for company in presentation_list:
...     key = some_dict.key[company]  # demo purposes only
...     value = some_dict[company]
...     print(key, company, value)
ibm IBM 2172
intel Intel 3210
amd AMD 4399

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18986>
_______________________________________


More information about the Python-bugs-list mailing list