Greg Wilson wrote: > > 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? Depends on the time frame of "breakfast" ;-) > 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... Two things: 1. the proposed syntax key:value does away with the easy to parse Python block statement syntax 2. why can't we use the old 'for x,y,z in something:' syntax and instead add iterators to the objects in question ? for key, value in object.iterator(): ... this doesn't only look better, it also allows having different iterators for different tasks (e.g. to iterate over values, key, items, row in a matrix, etc.) -- Marc-Andre Lemburg ______________________________________________________________________ Company: http://www.egenix.com/ Consulting: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4