How to force a single number to be a tuple

Gandalf gandalf at geochemsource.com
Wed Aug 4 12:36:02 EDT 2004


>You're going to get a zillion responses to this one.
>
>The syntax is a bit funky:
>
>y = (2,)
>
Funky. However, very logical. You can also write:

(1,2,3,4,)

instead of

(1,2,3,4)

The syntax is very clear and logical. (As usual when working with 
python.) Try to add one comma for each element - that will do the stuff.
Most of the languages are not so straightforward - they forbid the last 
comma.
Python is the best. :-)





More information about the Python-list mailing list