[Python-3000-checkins] r56418 ...
Guido van Rossum
guido at python.org
Thu Jul 26 17:50:47 CEST 2007
Good point. We get lazy when reviewing these things. Feel free to fix it!
On 7/26/07, skip at pobox.com <skip at pobox.com> wrote:
>
> >> Run 2to3 over the Demo/ directory to shut up parse errors from 2to3
> >> about lingering print statements.
>
> Skip> Shouldn't the list(dictionary.keys()) construct only be applied
> Skip> where it's needed?
>
> Guido> Yeah, but the tool doesn't know when it is or isn't needed. You'd
> Guido> think that "for x in d.keys(): ..." would be a context where it's
> Guido> certainly not needed, but that's (alas) not true -- if the loop
> Guido> body modifies d, the list() call is needed. See various other
> Guido> recent checkins.
>
> I wasn't complaining about the tool. I fully expect it to wrap d.keys()
> calls in list(). I thought the list() call should have been removed before
> checking in the file though.
>
> Skip
>
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000-checkins
mailing list