Re: [Tutor] Transforming object into subclass instance

2005-10-30 Thread Kent Johnson
Jan Eden wrote: > Now my question is: How can I turn an object of class X into an > object of either class Y or Z while (retaining all the attributes > defined so far). This is easy, in fact - you can change the class of an instance by assigning to its __class__ attribute: >>> class F(object):

[Tutor] Transforming object into subclass instance

2005-10-30 Thread Jan Eden
Hi, my program uses an initial "switch" statement to create an object: valid_types = dict( pages=Show.Page, syndicated=Show.Syndicated, authors=Show.Author, author_list=Show.AuthorList, galleries=Show.Gallery, pictures=Show.Picture, slideshow=Show.SlidePicture, tex