[Python-3000] Iterators for dict keys, values, and items == annoying :)

Jeremy Hylton jeremy at alum.mit.edu
Thu Mar 23 21:31:25 CET 2006


On 3/23/06, Ian Bicking <ianb at colorstudy.com> wrote:
> One idea I had after reading a post of Brett's was a dual-use attribute;
> if you do d.keys you get an iterable (not an iterator, of course), and
> if you call that iterable you get a list.  This is backward compatible,
> arguably prettier anyway to make it a property (since there's no side
> effects and getting an iterable isn't expensive, the method call seems
> somewhat superfluous).

I don't think we should overload attributes name such that they are
sometimes attributes and sometimes methods, particularly when they
return things that behave almost-but-not-quite the same.  It will
create confusion and subtle bugs.

Jeremy


More information about the Python-3000 mailing list