[Python-Dev] PEP 469: Restoring the iterkeys/values/items() methods

Cameron Simpson cs at zip.com.au
Mon Apr 21 05:50:28 CEST 2014


On 20Apr2014 20:12, Devin Jeanpierre <jeanpierreda at gmail.com> wrote:
>On Sun, Apr 20, 2014 at 8:01 PM, Cameron Simpson <cs at zip.com.au> wrote:
>> Me too. I'm against iteritems and friends coming back.
>> I've been burned in the past with the burden of writing a mapping class with
>> the many methods such a thing must support; both items() and iteritems() and
>> so forth. [...]
>
>As far as I know, all you have to implement yourself, to support the
>dict-like interface, are:
>
> - __getitem__
> - __setitem__
> - __delitem__
> - __iter__
> - __len__
>
>MutableMapping can implement the rest. This wouldn't change with the
>re-addition of the iter* methods.
>
>You really have to use MutableMapping now that keys/items/values are
>complicated objects: it's much harder to implement dict-like objects
>from scratch in 3.x than 2.x.

Fair point.

Thank you,
Cameron Simpson <cs at zip.com.au>

Draw little boxes with arrows.  It helps.       - Michael J. Eager


More information about the Python-Dev mailing list