Paul Rudin wrote:
> "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

> A common paradigm to get round this - assuming you want a different
> empty list each time - is something like:
> 
> def __init__(self, v = None):
>     self.values = v if v else []
> 
> (or maybe test explicitly for None, but you get the idea.)

Do test explicitly for None.  Otherwise, if you do

a = []
x = ThatClass (a)


it will so happen that x.values will be an empty list, but it won't be 
the same list as a.

        Mel.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to