Some thougts on cartesian products

Steven D'Aprano steve at REMOVETHIScyber.com.au
Mon Jan 23 16:32:50 EST 2006


On Mon, 23 Jan 2006 18:17:08 +0000, Bryan Olson wrote:

> Steven D'Aprano wrote:
>> Bryan Olson wrote:
>> 
>> 
> [Christoph Zwerschke had written:]
>>>>What I expect as the result is the "cartesian product" of the strings.
>>>
>>>There's no such thing; you'd have to define it first. Are duplicates
>>>significant? Order?
>> 
>> 
>> Google "cartesian product" and hit "I'm feeling lucky".
>> 
>> Or go here: http://mathworld.wolfram.com/CartesianProduct.html
>> 
>> Still think there is no such thing?
> 
> Uh, yes.
> 
>     The Cartesian product of two sets A and B (also called the
>     product set, set direct product, or cross product) is defined to
>     be the set of [...]
> 
> All sets, no strings. What were you looking at?

You've just quoted a definition of Cartesian product [yes, you are right
about capitalisation, my bad]. How can you say with a straight face that
there is no such thing as a Cartesian product?

The question of sets versus strings is a red herring. Addition, in
mathematics, is defined on reals. No computer yet made can do addition on
reals. Should you declare that there is no such thing as addition because
reals and floats are different?

If people wish to extend Cartesian products to work on sequences, not just
sets, then to my mind that's a pretty obvious and sensible generalisation.



-- 
Steven.




More information about the Python-list mailing list