Duncan Booth <[EMAIL PROTECTED]> writes:
> If you intend to only use the default some of the time, and at other
> times pass in a different list, then save the 'default' in the
> instance and use a special marker value to indicate when you intend
> the default to be used:

The most common idiom for such a marker is the None value.

    class Test(object):
        def __init__(self):
            self.L = []
        def f(self, a, L=None):
            if L is None:
                L = self.L
            L.append(a)
            return L

-- 
 \        "Consider the daffodil. And while you're doing that, I'll be |
  `\           over here, looking through your stuff."  -- Jack Handey |
_o__)                                                                  |
Ben Finney <http://www.benfinney.id.au/>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to