[issue39641] concatenation of Tuples

2020-02-16 Thread bruce blosser
bruce blosser added the comment: ok - well sorry, I am obviously in way over my head, and now very confused... I was just going by what was being said on a number of python web sites, including one where I am taking a class in intermediate python coding, and thought I was seeing a confiic

[issue39641] concatenation of Tuples

2020-02-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: [Bruce] > but try this, and it will NOT work: > > FatThing= [(5, 4, "First Place"), >(6, 6, "Fifer Place"), >(2, 2, "Slowr Place")] > print(FatThing) #this works > > FFThing = FatThing + ('22', '32', '55') #this causes an error! Th

[issue39641] concatenation of Tuples

2020-02-16 Thread SilentGhost
SilentGhost added the comment: Bruce, error message says exactly why it doesn't work: you're trying to add a tuple to a list, and that doesn't work. There isn't a "third" string created anywhere, you're confused about the types of the objects. Also, please, do not re-open closed issues. ---

[issue39641] concatenation of Tuples

2020-02-16 Thread bruce blosser
bruce blosser added the comment: read the advice... Yes this does work: ("Hello", 1, None) + (23, 19.5, "Goodbye") ('Hello', 1, None, 23, 19.5, 'Goodbye') because you are not creating a 3rd string! but try this, and it will NOT work: FatThing= [(5, 4, "First Place"), (6, 6,

[issue39641] concatenation of Tuples

2020-02-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: > The concatenation of two tuples into a third tuple, using the + command, > causes an error if every member of each of the two tuples is NOT a string! Works for me: py> ("Hello", 1, None) + (23, 19.5, "Goodbye") ('Hello', 1, None, 23, 19.5, 'Goodby

[issue39641] concatenation of Tuples

2020-02-15 Thread Ammar Askar
Ammar Askar added the comment: Are you trying to concatenate a single string? If so keep in mind you need a trailing comma: >>> (1, 2) + (3, 4) + ('a',) (1, 2, 3, 4, 'a') >>> (1, 2) + (3, 4) + ('a') Traceback (most recent call last): File "", line 1, in TypeError: can only concatenate tupl

[issue39641] concatenation of Tuples

2020-02-15 Thread Ammar Askar
Change by Ammar Askar : -- Removed message: https://bugs.python.org/msg362037 ___ Python tracker ___ ___ Python-bugs-list mailing li

[issue39641] concatenation of Tuples

2020-02-15 Thread Ammar Askar
Ammar Askar added the comment: tuple + tuple is NOT tuple concatenation. It adds each individual member of the tuple. So for example (a, b) + (c, d) results in (a + c, b + d) -- nosy: +ammar2 ___ Python tracker

[issue39641] concatenation of Tuples

2020-02-15 Thread bruce blosser
New submission from bruce blosser : The concatenation of two tuples into a third tuple, using the + command, causes an error if every member of each of the two tuples is NOT a string! This does not appear to be documented ANYWHERE, and really causes a whole lot of head scratching and more th