[issue8762] default value in constructor not unique across objects

2010-05-18 Thread Ray.Allen
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

[issue8762] default value in constructor not unique across objects

2010-05-18 Thread R. David Murray
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

[issue8762] default value in constructor not unique across objects

2010-05-18 Thread andrew
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(