[Tutor] Instance attribute as a parameter's default value
Jan Eden
lists at janeden.org
Fri Aug 26 14:54:26 CEST 2005
Hi,
I need to use an instance attribute as the default value for a parameter to a method.
This obviously won't work:
page.Children()
def Children(self, id=self.id, level=2):
How can I get the id parameter to use the attribute page.id? I know I could simply use the method call
page.Children(id=page.id)
but I thought it is much more elegant to use a default value here.
Is it possible?
TIA,
Jan
--
The day Microsoft makes something that doesn't suck is the day they start selling vacuum cleaners.
More information about the Tutor
mailing list