Why I think range is a wart.
Quinn Dunkan
quinn at barf.ugcs.caltech.edu
Thu Mar 14 14:57:44 EST 2002
On 13 Mar 2002 11:34:55 -0500, ruud de rooij <*@spam.ruud.org> wrote:
>perhaps lists should support .keys() and .items() for those operations
>(analogous to dictionaries).
This would also make writing polymorphic code easier. I sometimes write
methods that work on both dicts and lists and find myself doing stuff like
if hasatttr(o, 'keys'):
ks = o.keys()
else:
ks = range(len(o))
More information about the Python-list
mailing list