On 8/7/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > So concatenating mutable and immutable should give the > same result as concatenating two immutables, i.e. an > immutable. If you need to add something to the end of > your buffer, while keeping it mutable, you use extend(). > > This gives us > > immutable + immutable -> immutable > mutable + immutable -> immutable > immutable + mutable -> immutable > mutable + mutable -> mutable (*)
>>> () + [] Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: can only concatenate tuple (not "list") to tuple Less confusing to prohibit concatenation of mismatched types. There's always trivial workarounds (ie () + tuple([]) or .extend()). -- Adam Olsen, aka Rhamphoryncus _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
