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

Terry Reedy tjreedy at udel.edu
Fri Mar 31 09:12:22 CEST 2006


"Aahz" <aahz at pythoncraft.com> wrote in message 
news:20060331012037.GA7960 at panix.com...
> What do we want to tell people who have code like this:
>
> keys = d.keys()
> keys.sort()

Could a good-enough code analyzer detect such, even if separated by 
intervening lines?  If so, it could suggest sorted() as a fix.  I wonder if 
the pypy analyzer could be adapted for 2.x to 3.0 warning and upgrade 
purposes.  Or do pylint or pychecker gather enough information?

tjr





More information about the Python-3000 mailing list