Style question - defining immutable class data members

M R A Barnett pcw at
Sun Mar 15 18:27:43 CET 2009

Aaron Brady wrote:
> However, in my (opined) interpretation, 'list.append(...) is an in-
> place operation' is a factual error.  In-place operations -also-
> rebind their 'argument' (FLOBW for lack of better words).  'append' is
> a by-side-effect operation.  However colloquially it's mostly
> accurate.
All the augmented assignments rebind, even for objects which support
in-place operations. For example:

     my_list = []
     my_list += [0]

rebinds, but the equivalent:

     my_list = []


Augmented assignments which don't support in-place operations behave
like normal assignments (binding). For example:

     my_int = 0
     my_int += 1

behaves like:

     my_int = 0
     my_int = my_int + 1

More information about the Python-list mailing list