Hi,

http://objectmix.com/python/710201-dynamically-changing-base-class.html may be 
of interest.

wr

On Mittwoch, 4. Februar 2009 14:27:17 spir wrote:
> Hello,
>
> I have a strange problem and cannot see a clear method to solve it.
> I would like to build a custom type that is able to add some informational
> attributes and a bunch attribute to a main "value". The outline is then:
>
> class Custom(X):
>       def __init__(self, value, more):
>               X.__init__(self)
>               <define info attributes>
>       <custom methods>
>
> The base class is here to inherit value's behaviour and to avoid writing
> obj.value all the time. For this type will be heavily used by client code.
> The point is, this value may actually be of several builtin types.
> Logically, X is value.__class__. I imagine there are solutions using a
> factory, or __new__, or maybe metaclass (never done yet)? I cannot find a
> working method myself.
>
> Denis
>
> ------
> la vida e estranya
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to