要素が1つのタプルの和
タプル同士の和を求めるとき、要素がひとつしかないとint型とみなされてうまくいかない。
Python 3.3.2
In [1]: (1) + (2,3) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-30-608273b9461c> in <module>() ----> 1 (1) + (2,3) TypeError: unsupported operand type(s) for +: 'int' and 'tuple'
しかし、次のようにすれば連結させることができる。
In [2]: (1,) + (2,3) Out[2]: (1, 2, 3) In [3]: (1,) + (2,) Out[3]: (1, 2)
へー。