Why is Python popular, while Lisp and Scheme aren't?
holger krekel
pyth at devel.trillke.net
Wed Nov 27 18:02:33 EST 2002
Michael Hudson wrote:
> "Terry Reedy" <tjreedy at udel.edu> writes:
>
> > There was much discussion about which of dict.iterkeys(), iteritems(),
> > or itervalues() should be the default for 'in dict' both for 'if key
> > in dict' and 'for key in dict'. Note that since 'in seq' means same
> > sequence in both contexts for other containers (and same underlying
> > code is used to get sequence) it was wanted to keep 'in dict' meaning
> > same also. The consensus, considering use cases for both
> > constructions, was that keys are most ofter what is wanted. Think 'is
> > word in dictionary' rather than 'is word,definition in dictionary'.
> > Normal use of phonebook is similar.
>
> For what it's worth (not much) I'm forever writing
>
> for k, v in d:
> ....
>
> I can see the arguments for consistency, but I think this is my most
> reliable Python error at the moment.
TypeError: unpack non-sequence
is also my number one "basic" error i am producing.
But why don't i get it? My subconscious reasoning seems
to insist that 'for ... in y' should iterate over *everything* in y
not just some part of it.
or-so'ly holger
More information about the Python-list
mailing list