Benji York <[EMAIL PROTECTED]> writes:
> I'll add my 2 cents to the mix:
>
> default = object()
>
> class A(object):
> def __init__(self, n):
> self.data = n
>
> def f(self, x=default):
> if x is default:
> x = self.data
> print x
There were a lot of solutions like this. I'd like to point out that
you can put the "marker" in the class:
class A(object):
default = object()
def __init__(self, n):
self.data = n
def f(self, x = default):
if x is self.default:
x = self.data
print x
This way you don't pollute the module namespace with class-specific
names. You pollute the class namespace instead - which seems like an
improvement.
<mike
--
Mike Meyer <[EMAIL PROTECTED]> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
--
http://mail.python.org/mailman/listinfo/python-list