[Python-Dev] PEP 455: TransformDict

Ethan Furman ethan at stoneleaf.us
Tue Oct 8 01:45:58 CEST 2013


On 10/07/2013 02:55 PM, Ethan Furman wrote:
> A key difference (pun unavoidable ;) between __missing__ and __transform__ is that __missing__ is only called when a key
> is not found, while __transform__ needs to be called /every/ time a key is looked up:
>
>    d[k]
>    d.get(k)
>    d.has_key(k)
>    d.fromkeys(...)
>    d.setdefault(...)
>    k in d

Oh, and

      d.pop(k)

--
~Ethan~


More information about the Python-Dev mailing list