Greg Ewing wrote:
> On 6/05/20 7:45 pm, Henk-Jaap Wagenaar wrote:
> > So... say you are solving a problem in 1d, you do
> > that on a real number 
> > x, right? Now you solve it in 2d, so you do your work on a pair (x, y), 
> > then you might solve it in 3d and do your work on a triplet (x, y, z). A 
> > few days later you generalize it to n-dimensions and you get a 
> > sequence
> > At this point I would say that you haven't created an infinite
> tuple, you've created an infinite sequence of finite tuples.
> > Then, a few days later you generalize it to infinite
> > sequences (x_1, 
> > x_2, ...).
> > Now here I would stop and say, wait a minute, what does this
> proof look like? I'm willing to bet it involves things that
> assume some kind of intrinsic order to the elements of this
> "tuple". If it does, and it's an extension to the finite
> dimensional cases, then I would say you were really dealing
> with sequences, not tuples, right from the beginning.
> Now I must admit I was a bit hesitant about writing that
> statement, because in quantum theory, for example, one often
> deals with vector spaces having infinitely many dimensions.
> You could consider an element of such a space as being an
> infinite tuple.
> However, to even talk about such an object, you need to be
> able to write formulas involving the "nth element", and those
> formulas will necessarily depend on the numerical value of
> n. This gives the elements an intrinsic order, and they will
> have relationships to each other that depend on that order.
> This makes the object more like a sequence than a tuple.
> Contrast this with, for example, a tuple (x, y, z) representing
> coordinates in a geometrical space. There is no inherent
> sense in which the x coordinate comes "before" the y coordinate;
> that's just an accident of the order we chose to write them
> down in. We could have chosen any other order, and as long as
> we were consistent about it, everything would still work.
> This, I think, is the essence of the distinction between
> tuples and sequences in mathematics. Elements of sequences
> have an inherent order, whereas elements of a tuple have at
> best an arbitrarily-imposed order.

However, in Python, tuples and lists are both sequences, ordered sets of 
elements.

So it is not completely unreasoned to see them as Ahmed Amr is proposing: that 
is, so similar types that you can expect that if they have the same element, 
they are equal. (Like frozensets and sets in the "set type" domain).

Indeed, tuples and lists are equivalent in Python: `(list() == list(tuple()) 
and tuple(list()) == tuple()) is True`.

Do not misunderstand me. I agree with the idea that tuples and lists are 
different by design while frozenset and sets are not (as Steven D'Aprano 
pointed out in a previous posts).

But considering tuples and lists as just ordered sets of elements and based 
their equality on their elements, not in their type, is an appealing idea. I 
think that some Pythonists would not disagree.

A different thing is the practicality of this.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/T6BP6JBPMGCJEX4QF6SY4SM72344AEYF/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to