Implementing the recursive definition of Grays Code from Knuth I need to add values to tuples, I have:
In [54]: tuple_one = (1,0,0)
In [55]: tuple_one
Out[55]: (1, 0, 0)
In [56]: tuple_one += (1,)
In [57]: tuple_one
Out[57]: (1, 0, 0, 1)
However if I try and assign the above I get a syntax error
In [63]: B = tuple_one += (1,)
File "<ipython-input-63-537be8a059fc>", line 1
B = tuple_one += (1,)
^
SyntaxError: invalid syntax
Why is this ? Regards Paul
B = tuple_one += (1,)really is invalid syntax. TryB = tuple_one + (1,)appendto).