replacing instance __setattr__

Robin Becker robin at jessikat.fsnet.co.uk
Mon Jul 8 05:13:21 EDT 2002


In article <Z2kV8.37903$Jj7.1000491 at news1.tin.it>, Alex Martelli
<aleax at aleax.it> writes
>Robin Becker wrote:
......
>This doesn't impede your abilities to customize an instance, without
>affecting other instances of the same class:
>
>def changeSpecial(inst, name, function):
>    class Customized(inst.__class__): pass
>    setattr(customized, name, function)
>    inst.__class__ = Customized
>
>

yes I figured out I need to provide a dummy class to do this sort of
thing.

>Alex
>

-- 
Robin Becker



More information about the Python-list mailing list