How to force a single number to be a tuple

Bryan Olson bryanjugglercryptographer at yahoo.com
Fri Aug 6 23:29:12 CEST 2004


Gandalf wrote:
> 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.

The syntax may be logical, but it's not normal comma usage,.

> Python is the best. :-)

Python tuples overlap too much with lists, and differ from the 
functional/relational view in which a tuple is an element of the 
Cartesian product of zero or more domains.  Cartesian product is 
associative; (1, (2, 3)) = ((1, 2), 3) and is canonically 
written: (1, 2, 3).  Any object is identical to the one-tuple of 
that object.  What Python calls 'tuples' are really immutable 
lists.


-- 
--Bryan



More information about the Python-list mailing list