list(...) and list comprehensions (WAS: Arithmetic sequences in Python)
Rocco Moretti
roccomoretti at hotpop.com
Fri Jan 20 11:13:03 EST 2006
Antoon Pardon wrote:
> Well we could have list(a) return [a], and have a list_from_iterable.
> Although I would prefer a different name.
Or reverse it - list() always takes a single iterable, and
list_from_scalars() is defined something like follows:
>>> def list_from_scalars(*args):
return list(args)
>>> print list_from_scalars(1,2,3)
[1, 2, 3]
>>> print list_from_scalars('a')
['a']
>>>
More information about the Python-list
mailing list