On Fri, May 24, 2013 at 7:04 AM, Citizen Kant <[email protected]> wrote:
> Same happens with the tuple (100, 'value', 2); where parenthesis and semi
> colon work as a rule, setting the shape of a value named tuple that's
> different to the shape of a value named list. At the same time both shapes
> are equal (since both are value).
A semicolon is an optional way to delimit statements in Python. It's
rarely used since stacking multiple statements on a single line gets
ugly fast.
A tuple is defined by commas, depending on context. However,
parentheses are typically required because commas have low precedence.
>>> 1, 2 + 3, 4
(1, 5, 4)
>>> (1, 2) + (3, 4)
(1, 2, 3, 4)
An empty tuple is a special case:
>>> x = ()
>>> type(x)
<type 'tuple'>
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor