Modifying the {} and [] tokens

Terry Reedy tjreedy at udel.edu
Sun Aug 24 03:20:52 EDT 2003


"> If you can conjure up the right Google Groups query, this has been
discussed
> many times in the past (and by that I mean some good points have
been raised
> that you might find interesting). In particular, I remember Alex
Martelli
> making a good argument for len(obj) over obj.len().

One point someone made is summarized by the following contrast:

collections = (atuple, alist, adict, someothercollection)
flengths = map(len, collections) #actual
mlengths = map(lambda obj: gettattr(obj, 'len')(), collections)
#hypothetical
# or listcomp equivalents

Terry J. Reedu






More information about the Python-list mailing list