Is current integer for-loop syntax a wart?

Courageous jkraska at san.rr.com
Sat Mar 9 12:09:32 EST 2002


>What you sohuld be able to do is say:
>
>   for i in a.keys():
>      b[i] = a[i]

Thinking about this, what you say seems plainly correct.
Both Python lists and dictionaries have keys and values:
it's just that, for some reason, we don't think of lists
as having 'keys' for some reason, even though they plainly
do.

It would follow that the appropriate implementation of this
would be to return a iterator.

C//




More information about the Python-list mailing list