[Python-ideas] Add dict.getkey() and set.get()

Nick Coghlan ncoghlan at gmail.com
Sat Sep 14 18:59:38 CEST 2013


I'll also note that in any case where I've needed to be able to
determine the "canonical form" of a key, I've known the transform to
use (e.g. str.lower, int, operator.index) rather than (or in addition
to) having a container holding the canonical forms.

If this is inspired by the transform dict PEP, then it may be better
to expose the conversion function rather than a way to ask the
container to do the conversion itself (yes, I'm aware I suggested the
latter approach the other day - this thread is making me reconsider).

Cheers,
Nick.


More information about the Python-ideas mailing list