Stephen J. Turnbull wrote: > Benjamin Peterson writes: > > > > I suppose there's no way to get the compiler to both make "for x in d" > > > work as above, and make "for k, v in d" be equivalent to Python 2's > > > "for k, v in d.iteritems()"? > > it would change the meaning of currently correct > programs, so it's a non-starter. Maybe what's wanted is a function analogous to enumerate() for mappings instead of sequences. Picking a semi-arbitrary name for now: for k, v in tabulate(d): ... It could be special-cased to recognise dicts and do the appropriate thing for the Python version concerned. If it doesn't recognise the type, it would fall back to a generic implementation like for k in d: v = d[k]: ... -- Greg
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