[Python-Dev] re: Sets BOF / for in dict
Greg Wilson
gvwilson@ca.baltimore.com
Sun, 4 Feb 2001 09:19:47 -0500
I've spoken with Barbara Fuller (IPC9 org.); the two openings for a
BOF on sets are breakfast or lunch on Wednesday the 7th. I'd prefer
breakfast (less chance of me missing my flight :-); is there anyone
who's interested in attending who *can't* make that time, but *could*
make lunch?
And meanwhile:
> Ka-Ping Yee:
> - the key:value syntax suggested by Guido (i like it quite a lot)
Greg Wilson:
Did another quick poll; feeling here is that if
for key:value in dict:
works, then:
for index:value in sequence:
would also be expected to work. If the keys to the dictionary are (for
example) 2-element tuples, then:
for (left, right):value in dict:
would also be expected to work, just as:
for ((left, right), value) in dict.items():
now works.
Question: would the current proposal allow NumPy arrays (just as an
example) to support both:
for index:value in numPyArray:
where 'index' would get tuples like '(0, 3, 2)' for a 3D array, *and*
for (i, j, k):value in numPyArray:
If so, then yeah, it would tidy up a fair bit of my code...
Thanks,
Greg