On Wed, May 06, 2020 at 02:58:01AM +0100, Henk-Jaap Wagenaar wrote: > I don't think that is accurate to represent as a representation of "a > mathematician". The top voted answer here disagrees: > https://math.stackexchange.com/questions/122595/whats-the-difference-between-tuples-and-sequences > > "A sequence requires each element to be of the same type. > A tuple can have elements with different types."
Are you saying that you can't have a sequence that alternates between ints and rationals, say, or ints and surds (reals)? The sequence A_n = sqrt(n) from n=0 starts off int, int, real, ... so there is that. For what its worth, Wolfram Mathworld disagrees with both Greg's comment and the stackexchange answer, stating that a tuple is just a synonym for a list, and that both lists and sequences are ordered sets: https://mathworld.wolfram.com/n-Tuple.html https://mathworld.wolfram.com/List.html https://mathworld.wolfram.com/Sequence.html > The common usage for both is: you have a tuple of (Z, +) representing the > Abelian group of addition (+) on the integers (Z), whereas you have the > sequence {1/n}_{n \in N} converging to 0 in the space Q^N (rational > infinite sequences) for example. One can come up with many other usages. I think a far more common use for tuples are the ordered pairs used for coordinates: (1, 2) So although tuples are ordered sets, and sequences are ordered sets, the way they are used is very different. One would not call the coordinate (1, 2) a sequence 1 followed by 2, and one would not normally consider a sequence such as [0, 2, 4, 6, 8, ...] to be a tuple. In normal use, a tuple is considered to be an atomic[1] object (e.g. a point in space), while a sequence is, in a sense, a kind of iterative process that has been reified. > I'd say the difference is just one of semantics The difference between any two things is always one of semantics. > and as a mathematician I > would consider tuples and sequences as "isomorphic", in fact, the > set-theoretical construction of tuples as functions is *identical* to the > usual definition of sequences: i.e. they are just two interpretations of > the the same object depending on your point of view. Many things are isomorphic. "Prime numbers greater than a googolplex" are isomorphic to the partial sums of the sequence 1/2 − 1/4 + 1/8 − 1/16 + ⋯ = 1/3 but that doesn't mean you could use 1/2 * 1/4 as your RSA public key :-) [1] I used that term intentionally, since we know that if you hit an atom hard enough, it ceases to be indivisible and can split apart :-) -- Steven _______________________________________________ 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/XYGTJAV73KEWRVLGV3CZKOF2F43GGYSK/ Code of Conduct: http://python.org/psf/codeofconduct/