Parens do create a tuple

Ben Finney ben+python at benfinney.id.au
Sun Apr 10 20:57:28 EDT 2016


Chris Angelico <rosuav at gmail.com> writes:

> On Mon, Apr 11, 2016 at 10:45 AM, Ben Finney <ben+python at benfinney.id.au> wrote:
> > So the expanation that remains true when you examine it is: People
> > wanted a literal syntax to create a zero-length tuple. A pair of parens
> > is that literal syntax, and it's the parens that create the (empty)
> > tuple.
>
> But parens do NOT create a one-element tuple, and that's usually where
> people trip up.

So let's stop saying “parens do not create a tuple”, because that's just
wantonly creating *another* stubling block.

-- 
 \         “Pinky, are you pondering what I'm pondering?” “I think so, |
  `\    Brain, but don't you need a swimming pool to play Marco Polo?” |
_o__)                                           —_Pinky and The Brain_ |
Ben Finney




More information about the Python-list mailing list