F
Frank Millman
Hi all
This is just out of curiosity.
I have a tuple, and I want to create a new tuple with a new value in the
first position, and everything else unchanged.
I figured out that this would work -
Then I thought I would neaten it a bit by replacing "('x',)" with "'x'," on
the assumption that it is not necessary to surround a tuple with brackets.
This is the result -
It is not a problem - I will just stick to using the brackets. However, I
would be interested to find out the reason for the error.
Version is 2.6.2.
Thanks
Frank Millman
This is just out of curiosity.
I have a tuple, and I want to create a new tuple with a new value in the
first position, and everything else unchanged.
I figured out that this would work -
('x', 'b', 'c')t = ('a', 'b', 'c')
t2 = ('x',) + t[1:]
t2
Then I thought I would neaten it a bit by replacing "('x',)" with "'x'," on
the assumption that it is not necessary to surround a tuple with brackets.
This is the result -
Traceback (most recent call last):t = ('a', 'b', 'c')
t2 = 'x', + t[1:]
It is not a problem - I will just stick to using the brackets. However, I
would be interested to find out the reason for the error.
Version is 2.6.2.
Thanks
Frank Millman