Augmented augmented assignment?
Dale Strickland-Clark
dale at riverhall.NOTHANKS.co.uk
Mon Oct 22 18:20:23 EDT 2001
More information about the Python-list mailing list
Mon Oct 22 18:20:23 EDT 2001
- Previous message (by thread): Augmented augmented assignment?
- Next message (by thread): Mixing asyncore with threads
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Can someone explain this? It doesn't seem obvious to me but it's quite handy. I assume it's something to do with the in-place operation of augmented assignment but I can't seem to reproduce it using normal assignment. >>> x = 'spam' >>> y = [] >>> y = y + x Traceback (most recent call last): File "<interactive input>", line 1, in ? TypeError: can only concatenate list (not "string") to list >>> y += x >>> y ['s', 'p', 'a', 'm'] >>> -- Dale Strickland-Clark Riverhall Systems Ltd
- Previous message (by thread): Augmented augmented assignment?
- Next message (by thread): Mixing asyncore with threads
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list