On Mon, 2008-03-17 at 15:42 +0100, Duncan Webb wrote:
> class A:
> def __init__(self, l=[]):
> self.l = l
Note that this creates a default list for l only once at
class-declaration time. All instances of A will share this list. This
is a common python gotcha. You might want instead:
class A:
def __init__(self, l=None):
self.l = l or []
> This behaviour seems a bit strange, clearly list is class A is the same
> objects for both instances and I'm wondering if this is correct?
Yes, it's expected behaviour.
Cheers,
Jason.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-devel