pitfall for your amusement

Gustavo Niemeyer niemeyer at conectiva.com
Tue Nov 12 16:07:18 EST 2002


> > > >>> x = (1, 2, 3)
> > [...]
> > > >>> x += (4, 5, 6)
> > 
> > Hey, shouldn't this raise an exception?
> 
> Because the tuple is immutable? Then would you expect
> 
> x += 1
> 
> to raise an exception also?

Good point. I was wrongly interpreting it like [].extend.

-- 
Gustavo Niemeyer

[ 2AAC 7928 0FBF 0299 5EB5  60E2 2253 B29A 6664 3A0C ]




More information about the Python-list mailing list