A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-September/128599.html below:

[Python-Dev] Add a "transformdict" to collections

[Python-Dev] Add a "transformdict" to collections [Python-Dev] Add a "transformdict" to collectionsEthan Furman ethan at stoneleaf.us
Thu Sep 12 16:08:47 CEST 2013
On 09/11/2013 02:39 PM, Tim Delaney wrote:
>
> I would think that retrieving the keys from the dict would return the transformed keys (I'd
> call them canonical keys).

The more I think about this the more I agree.  A canonicaldict with a key function that simply stored the transformed 
key and it's value would seem to be a lot simpler:

   - no need to store a separate "presentation" key
   - no confusion about which of the first key/last key seen is stored
   - no mistakes with the "first" key not being added before real data
     and getting the presentation key wrong

Further, in order to store the non-canonical keys a separate list must be kept of the keys to preseed the canonicaldict; 
if we store the canonical keys a separate list must be kept for presentation purposes -- so worst case scenario we're 
keeping the same amount of information and best-case scenario the presentation of the keys doesn't matter and we just 
saved ourselves an extra data structure.

--
~Ethan~
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4