Tuple Syntax and ()
Steve Holden
steve at holdenweb.com
Wed Jun 14 05:22:36 EDT 2006
tactics40 at gmail.com wrote:
> I keep accidently trying to declare t-tuples as mytuple = (myitem)
>
> I know this doesn't work and that you need the trailing comma, but
> reading something online, I just came to realize.... the parenthesises
> don't have any special meaning in relation to tuples at all, do they?
>
Give that (?)man a cigar! The only time the parentheses are necessary is
when you need to disambiguate - the most frequent needs are:
() for an empty tuple: there's no other way to express that without
using tuple(), and
f((a, b, ...)) to provide a single tuple argument to a function.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Love me, love my blog http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden
More information about the Python-list
mailing list