I'm a python addict !

J. Cliff Dyer jcd at sdf.lonestar.org
Mon Jan 26 11:54:10 EST 2009


On Fri, 2009-01-23 at 20:25 -0800, Paul McGuire wrote:
> Want to change the type/behavior of an object from class A to class
> B?  How about this:
> 
>     aobj = A()
>     aobj.__class__ = B
> 
> Try *that* in as simple-looking C++ or Java!

Wow.  That looks very powerful and fun.  But scary.  Any thoughts on how
you would use that in a way that wouldn't unleash sulphurous code
smells?

Cheers,
Cliff





More information about the Python-list mailing list