Why tuples use parentheses ()'s instead of something else like <>'s?

Steve Holden steve at holdenweb.com
Wed Dec 29 14:35:02 CET 2004


Marius Bernklev wrote:

> * seberino at spawar.navy.mil
> 
> 
>>Perhaps ()'s are a good idea for some other reason I don't know?
> 
> 
> One-element tuples are written as (4,).
> 
And, even there, the parenthesis is only required when it would 
otherwise be embiguous:

  >>> x = 4,
  >>> x
(4,)
  >>> print 4,
4
  >>>

regards
  Steve
-- 
Steve Holden               http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC      +1 703 861 4237  +1 800 494 3119



More information about the Python-list mailing list