list(...) and list comprehensions (WAS: Arithmetic sequences in Python)

Steve Holden steve at holdenweb.com
Wed Jan 18 14:59:58 EST 2006


Diez B. Roggisch wrote:
>>due to the nested parentheses.  Note that replacing list comprehensions 
>>with list(...) doesn't introduce any nested parentheses; it basically 
>>just replaces brackets with parentheses.
> 
> 
> But you don't need the nested parentheses - use *args instead for the 
> list-constructor.
> 
> list(a,b,c)
> 
> Apart from that, I hope that the [] stay in. After all, if they are kept 
> around for literal list construction, the aren't free for other purposes 
> anyway.
> 
  >>> list(1,2,3)
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
TypeError: list() takes at most 1 argument (3 given)
  >>>

So you're talking about the way list() *should* work in Python 3, right?

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/




More information about the Python-list mailing list