Bruno Desthuilliers <bruno.42.desthuilli...@websiteburo.invalid> wrote:
> If you don't want to create as many Whatever instances as MyClass > instances, you can create a single Whatever instance before defining > your class: > > DEFAULT_WHATEVER = Whathever() > > class MyClass(object): > def __init__(self, x, y): > self.x = x > self.y = y > self.size = DEFAULT_WHATEVER > > Or you could create the default as a class attribute and it can be overridden in those instances which need a different value. class MyClass(object): size = Whatever() def __init__(self, x, y): self.x = x self.y = y -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list