Michael Urman wrote:
> class Test(object):
> class foo(Property):
> """The foo property"""
> def get(self): return self._foo
> def set(self, val): self._foo = val
> def delete(self): del self._foo
>
> test = Test()
> test.foo = 'Yay!'
> assert test._foo == 'Yay!'
Thus proving once again, that metaclasses are the one true way to monkey with
classes ;)
Cheers,
Nick.
P.S. I think I need an email program that disables the send button after 11
pm. . .
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---------------------------------------------------------------
http://boredomandlaziness.blogspot.com
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com