variables of the class are not available as default values?

Aahz aahz at
Sat Aug 29 03:25:57 CEST 2009

In article <mailman.547.1251409496.2854.python-list at>,
Chris Rebert  <clp2 at> wrote:
>class foo:
>    def __init__(self, maxvalue):
>        self.maxvalue =3D maxvalue
>        self.value =3D 0
>    def put(self, value=3DNone):
>        self.value =3D self.value if value is None else value

Stylistic nit:

I'd make that

        self.value = value if value is not None else self.value

The reason is that the "primary" value should go first.
Aahz (aahz at           <*>

"I support family values -- Addams family values"

More information about the Python-list mailing list