Ezio Melotti added the comment: This is not a bug, see https://docs.python.org/3.6/faq/programming.html#why-are-default-values-shared-between-objects
In the first case L is evaluated once at compile time. In the second case L is always set to a new empty list, regardless of what you pass as second argument to f. In the third case L is set to a new empty list only if you don't pass a second argument (or if you pass None). ---------- nosy: +ezio.melotti resolution: -> not a bug stage: -> resolved status: open -> closed type: -> behavior _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26458> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com