> > > > On Mon, 5 Feb 2001, Greg Wilson wrote: > > > > Based on my very-informal survey, if: > > > > for i in someList: > > > > works, then many people will assume that: > > > > for i in someDict: > > > > will also work, and yield values. > > > Ka-Ping Yee: > > > ...the latter is ambiguous (keys or values?)... > > Greg Wilson > > The latter is exactly as ambiguous as the former... I think this > > is a case where your (intimate) familiarity with the way Python > > works now is preventing you from getting into newbie headspace... > Ka-Ping Yee: > No, i don't think so. It seems quite possible to argue from first > principles that if you ask to iterate over things "in" a sequence, > you clearly want the items in the sequence, not their integer indices. Greg Wilson: Well, arguing from first principles, Aristotle was able to demonstrate that heavy objects fall faster than light ones :-). I'm basing my claim on the kind of errors students in my course make. Even after being shown half-a-dozen examples of Python for loops, many of them write: for i in someSequence: print someSequence[i] in their first exercise. Thanks, 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