Some thougts on cartesian products
fakeaddress at nowhere.org
Tue Jan 24 08:22:08 CET 2006
Christoph Zwerschke wrote:
> Bryan Olson schrieb:
>>> 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?
> Not only sets.
Snipping is not going to make the facts go away. I did not
choose the reference at issue in this strand:
> This goes on (anyway "everything is a set").
The claim "everything is a set" falls into the category of
'not even wrong'. Whatever semantics Python adopts, it must
Watch things not be sets:
x = [1, 1, 2]
y = [1, 2]
print x == y
print set(x) == set(y)
> You can also
> have the Cartesian product of functions. And you can think of a string
> as a function from a countable index set I to the set of all characters
> C. So the Cartesian product of two strings will become a function from
> IxI to CxC. Since IxX is countable again, this is equivalent to a tuple
> of 2-tuples of characters which you can also interpret as a tuple of
> strings with 2 chars:
> "ab" x "cd" = ("ac", "ad", "bc", "bd")
I really did try to raise the real issues. I cannot make you answer,
but the question remains: are duplicate and order significant in
what you call "Cartesian product" or they not? Can you show that
your proposed language extensions are useful and consistent in
some reasonable sense?
> Do I have eliminated all remaining clarities now? :-)
Yes. Good one. Sure.
More information about the Python-list