one-element tuples [Was: Most probably a stupid question, but I still want to ask]

Chris Angelico rosuav at gmail.com
Sun Apr 10 22:34:56 EDT 2016


On Mon, Apr 11, 2016 at 12:22 PM, Dan Sommers <dan at tombstonezero.net> wrote:
> On Mon, 11 Apr 2016 01:33:10 +0100, MRAB wrote:
>
>> There _is_ one exception though: (). It's the empty tuple (a 0-element
>> tuple). It doesn't have a comma and the parentheses are mandatory.
>> There's no other way to write it.
>
> The other way to write it is:
>
>     tuple()

There are lots of ways to construct an empty tuple, but only one
spelling for its literal.

ChrisA



More information about the Python-list mailing list