I would like to use a class attribute as a default value for one of the arguments to my class's
__init__ method. This construct raises a
NameError exception, though, and I don't understand why:
class MyClass(): __DefaultName = 'DefaultName' def __init__(self, name = MyClass.__DefaultName): self.name = name
Why does this fail, and is there a way to do this that works?