Discussion about PEP 234: iterators
Raymond Hettinger
othello at javanet.com
Fri Feb 16 17:09:47 EST 2001
I think dictionary iteration should match iterations on other objects/types
as closely as possible unless performance is impacted.
for elem in list # does not automatically sort
for key in dict # so this should not automatically sort
for key:value in dict # proposed
for index:item in list # so this should work
if elem in list # this works
if key in dict # so this should work
map( fun, list ) # this works
map( func, dict ) # so this should work with functions that take a key as
a parameter
filter( boolfun, list ) # gives a possibly smaller list
filter( boolfun, dict ) # so this should return a possibly smaller
dictionary
Thanks,
Raymond
More information about the Python-list
mailing list