Creating a new instance of a class by what is sent in?

ChinStrap caneff at gmail.com
Mon Apr 11 14:42:10 EDT 2005


I am sorry if this is obvious, but I am not seeing it.  How would I go
about creating a new type that is of the same type as a class sent into
the function?

new = foo.__init__() refers to the current foo, not a new fresh
instance of my class.  The only way I can think of is to make a large
if-elif chain of isinstances, but that loses the generality I am after.

Thank you for your help.




More information about the Python-list mailing list