Am 13.09.2016 um 12:09 schrieb Chris Angelico:
On Tue, Sep 13, 2016 at 8:01 PM, Antoon Pardon
<antoon.par...@rece.vub.ac.be> wrote:
Then python seems to be broken:
]]] a = range(3)
]]] old_a = a
]]] a += [8, 13]
]]] id(a), id(old_a)
(140062018784792, 140062018784792)
]]] a, old_a
([0, 1, 2, 8, 13], [0, 1, 2, 8, 13])
A range object is not a tuple. Nor (since you were probably running
this in Python 2) is a list.
Not probably, certainly (if it wasn't Python 1):
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64
bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> a = range(3)
>>> a += [8, 13]
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
a += [8, 13]
TypeError: unsupported operand type(s) for +=: 'range' and 'list'
>>>
--
https://mail.python.org/mailman/listinfo/python-list