Why the expression "(1)" is not an one-arity tuple, but int ?

Baptiste Lepilleur baptiste.lepilleur at gmail.com
Fri Dec 4 07:26:56 EST 2009


By adding a before the closing brace of the tuple. Python allow this to
disambiguate between braced expression and tuple

>>> type( (1,) )
<type 'tuple'>


2009/12/4 Петров Александр <gmdidro at gmail.com>

>
> How could I tell Python that "(1)" is not an integer, but an one-arity
> tuple ?
>
> Thank you,
> Alexander Petrov
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091204/e6b11b3e/attachment.html>


More information about the Python-list mailing list