copy on write
jeanpierreda at gmail.com
Thu Feb 2 07:34:48 CET 2012
On Wed, Feb 1, 2012 at 10:18 PM, John O'Hagan <research at johnohagan.com> wrote:
> On Fri, 13 Jan 2012 10:40:47 -0800
> Ethan Furman <ethan at stoneleaf.us> wrote:
>> Steven D'Aprano wrote:
>> > Normally this is harmless, but there is one interesting little
>> > glitch you can get:
>> >>>> t = ('a', )
>> >>>> t += 
>> > Traceback (most recent call last):
>> > File "<stdin>", line 1, in <module>
>> > TypeError: 'tuple' object does not support item assignment
>> >>>> t
>> > ('a', [23, 42])
> IMHO, this is worthy of bug-hood: shouldn't we be able to conclude from the TypeError that the assignment failed?
It did fail. The mutation did not.
I can't think of any way out of this misleadingness, although if you
can that would be pretty awesome.
More information about the Python-list