On Apr 11, 12:54 pm, Steven D'Aprano <st...@remove-this-
cybersource.com.au> wrote:

> Ah, now it is more clear.
>
> Okay, let's try this:
>
> >>> class C(object):
>
> ...     def __getattr__(self, name):
> ...             # Only called if self.name doesn't exist.
> ...             inst = self.__class__()
> ...             setattr(self, name, inst)
> ...             return inst

Ha! Perfect! I knew it should be simpler. Thanks very much!

Kind regards,

Edd
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to