How to force a single number to be a tuple
fakeaddress at nowhere.org
Sun Aug 8 06:59:48 CEST 2004
Roy Smith wrote:
> For those of us who went to school a while ago, and perhaps didn't pay
> as much attention in math class as we should have, could you translate
> "an element of the Cartesian product of zero or more domains" into
A domain is a set; it's used in the contexts like the domain of
a function, where it means the values for which the function is
defined. I see others have explained the Cartesian product.
> My Python code built up a list of the values and generated [1, 2,
> "three", "four"]. My two friends recoiled violently at the idea that I
> would put heterogeneous data types into a list. I passed it off as
> simply being due to their poor unfortunate upbringing in the C++/STL
> world of type bondage, while I was living in the carefree bohemian
> Python world. I was shocked to discover some time later that Python was
> not as bohemian as I thought, and the priests and elders would have been
> as dismayed at my carefree mixing of data types in a list as my stodgy
> C++ brethren were.
Perhaps those priests and elders would be happier in ML or one
of its followers. There's a lot to be said for uniform-type
lists, but that's not Python's idea of lists.
More information about the Python-list