maybe a bug in python
Steven Bethard
steven.bethard at gmail.com
Mon Jun 6 14:13:05 EDT 2005
venkata subramanian wrote:
> If you have any doubts,
> try to remeber this when creating tuples,
>
> if a tuple is to have 0 elements,
> then it must be given as a=()
> in other words, the ( and the ) are essential
>
> if it has one element,
> then a comma after that element is essential
> a=1,
> or alternatively
> a=(1,)
> in other words, an end comma is essential but the parentheses are not
>
> if it has more than one element, comma between the elements is only essential
> a=1,2
> or alternatively
> a=1,2,
> or alternatively
> a=(1,2)
That actually looks like a pretty good summary. I've posted it, with a
few elaborations at:
http://wiki.python.org/moin/TupleSyntax
STeVe
More information about the Python-list
mailing list