[dictionary] how to get key by item
Roy Smith
roy at panix.com
Mon Dec 13 22:17:13 EST 2004
More information about the Python-list mailing list
Mon Dec 13 22:17:13 EST 2004
- Previous message (by thread): [dictionary] how to get key by item
- Next message (by thread): [dictionary] how to get key by item
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Skip Montanaro <skip at pobox.com> wrote: > Roy> BTW, does Python really build the intermediate list and throw it > Roy> away after using it to initialize the dictionary, or is it smart > Roy> enough to know that it doesn't really need to build the whole list > Roy> in memory? > > That's why I called .iteritems() in my example. It won't generate the > entire list of tuples as .items() would. I know it won't generate the list of items from the forward dict, but I was thinking of the list generated by the list comprehension, passed as the argument to the reverse dict constructor. That's the throw-away list I was thinking of (see Tim Delaney's response to my post).
- Previous message (by thread): [dictionary] how to get key by item
- Next message (by thread): [dictionary] how to get key by item
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list