Le Tue, 10 Sep 2013 22:00:37 +1000,
Nick Coghlan <ncogh...@gmail.com> a écrit :
> Is this just syntactic sugar for recursive lookup of a transformed
> version in __missing__?

Nope. For one, it doesn't use __missing__ at all. I think
using __missing__ would be... missing the point, because it wouldn't
working properly if you have e.g. X != Y such that transform(X) == Y
and transform(Y) == X.

(a simple example being transform = str.swapcase :-))

> Or a way of supplying a custom "key" function
> to a dictionary?

Probably, although I'm not entirely sure what you mean by that :-)

> Any such proposal should consider how it composes with other dict
> variants like defaultdict, OrderedDict and counter.

Well, one sticking point here is that those variants don't compose with
each other already :-)
But, yes, I may make another proposal with composition in mind.

Regards

Antoine.


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to