En Wed, 06 Feb 2008 18:06:48 -0200, <[EMAIL PROTECTED]>  
escribió:

> So I understand that properties belong to a class not an instance, but
> nonetheless I want to add properties to an instance. I have a class
> which when an instance is created runs some fairly complicated code
> and produces a set of names which I'd like to be able to access via
> properties.

I'd suggest a small improvement: _A as a class name isn't very nice.  
Replace the inner class statement with:
_A = type(self.__class__.__name__ + '_autoprops', (self.__class__,), {})

A problem with this approach is that instances aren't pickleable (perhaps  
that could be solved using __reduce__)

-- 
Gabriel Genellina

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

Reply via email to