Some thougts on cartesian products

Bryan Olson fakeaddress at
Mon Jan 23 22:26:00 EST 2006

Steven D'Aprano wrote:
> 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:
>>>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?

Ah, I think I see. I said there's no such thing as the Cartesian
product of stings. You thought I claimed that there's no such thing
as Cartesian product at all. Try re-reading what I wrote and what
your chosen reference says.

> 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.

You lost me. Are you advocating implementing it without defining
it? Or are you saying the the significance of duplicates and order
are so obvious that those were silly questions?


More information about the Python-list mailing list