[issue42379] Optional List Args Persist Across Objects

Eric V. Smith report at bugs.python.org
Mon Nov 16 15:55:51 EST 2020


Eric V. Smith <eric at trueblade.com> added the comment:

This is defined behavior in the language, so it's not a bug. The "pythonic" way to deal with this is usually:

def funct(self, array = None):
    if array is None:
         array = []

----------
components: +Interpreter Core -ctypes
nosy: +eric.smith
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42379>
_______________________________________


More information about the Python-bugs-list mailing list