Changing the class of an instance

david_ullrich at my-deja.com david_ullrich at my-deja.com
Thu Jul 13 13:40:51 EDT 2000


In article <8ki9bf$2pg3$1 at pc-news.cogsci.ed.ac.uk>,
  richard at cogsci.ed.ac.uk (Richard Tobin) wrote:
> Is it legal (it seems to work) to change the class of an object by
> assigning to its __class__ attribute?  In particular for the case
where
> the new class is a subclass of the old.
>
> I'm not looking for an argument (not even the five minute one) about
> whether it's a good idea, just whether it's legal.

    I can't imagine there being any _argument_ about whether
it's a good idea...

    If you said what you were trying to do someone would show
you how to do it without trying to change the class of an
instance. (Or not, but I can't imagine what it could be
that would require this.)

DU

> -- Richard
>
> --
> Spam filter: to mail me from a .com/.net site, put my surname in the
headers.
>
> "The Internet is really just a series of bottlenecks joined by high
> speed networks." - Sam Wilson
>


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list