Arithmetic sequences in Python

Steven Bethard steven.bethard at gmail.com
Thu Jan 19 13:17:56 EST 2006


Steven D'Aprano wrote:
> Steven Bethard wrote:
> 
>> I'm not sure I find it truly hateful, but definitely unnecessary. 
>> TOOWTDI and all...
> 
[snip]
> 
> Even when people mean One Obvious and not Only One, it is still harmful 
> because the emphasis is wrong. The emphasis is on the *restrictive 
> nature* of a language which merely gives one obvious way of doing things.

Perhaps just the *perceived* emphasis is wrong?  Let me elaborate...

My intent was only to indicate that I don't think we *gain* anything by 
having two forms that are quite similar both syntactically and 
semantically.  Both [...] and list(...) use exactly the same syntax for 
the inner expression[1].  Both use parentheses/brackets, so the inner 
expression can be broken across multiple lines in the same ways.  Both 
produce the same result, a list created in the appropriate manner.

So why have both?  That's all I meant by TOOWTDI.

FWIW, I've posted my arguments for removing the redundant [...] 
expression in Python 3.0 at:

     http://wiki.python.org/moin/Python3%2e0Suggestions#preview

STeVe

[1] Reminder: I'm *not* arguing for list literals to look like 
list(...), only for list comprehensions to look that way.



More information about the Python-list mailing list