[Python-3000] PEP 3106: Revamping dict.keys(), .values() and .items()

Guido van Rossum guido at python.org
Sun Dec 24 02:37:16 CET 2006

On 12/23/06, George Sakkis <gsakkis at rutgers.edu> wrote:
> On 12/23/06, Guido van Rossum <guido at python.org> wrote:
> > If I left your specific suggestion or question unaddressed or
> > unanswered, please send it again (after re-reading the PEP, of
> > course).
> Shouldn't there be a motivation section ? If nothing else, it should
> discuss (or at least link to a previous discussion) why the original
> plan of using plain iterators was rejected. Iteration is probably the
> most common view operation by far, and it's trivial for the user to
> populate any other container if necessary. Is the complexity of adding
> three new types with non obvious semantics justified ? If so, some
> more compelling use cases would help; I don't think the shown example
> is really an improvement in readability or performance over
>     for k, v in d.items(): ...
>     for k, v in d.items(): ..

I thought that being able to use keys and items as sets without having
to copy them is cool enough to motivate the proposal. I'm sure when
this was first brought up (and it was brought up and AFAIK agreed to
approximately a year ago) plenty of motivation was discussed. Maybe
you can suggest some words for a motivational section, if you think
one is needed? At this point I'm personally more interested in getting
the specification as tight as possible.

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-3000 mailing list