Ray.Allen added the comment:
Here is the explanation from Python Language Reference 7.6: Function Definitions
"""
When one or more top-level parameters have the form parameter = expression, the
function is said to have ``default parameter values.'' For a parameter with a
default value, the cor
R. David Murray added the comment:
This is not a bug, it's how Python works. Default values are computed at
function definition time, so there's only one list across all the function
invocations.
--
nosy: +r.david.murray
resolution: -> invalid
stage: -> committed/rejected
status: o
New submission from andrew :
After debugging for a while I finally released that I stumbled across a Python
bug (at least I believe it is). Here is a proof of concept that produces the
issue:
!/usr/bin/python
class blah:
def __init__(self, items=[]):
self.items = items
a = blah(