New inited instance of class?

Samuel Kleiner sam at samuel-kleiners-computer.local
Sat Dec 6 22:37:58 EST 2003


Is there a builtin way of making making another instance of your own
class? I really expected type(self)(*args, **keywords) to work this way.
Currently i'm doing this:

def new(self,*args,**keywords):
        from new import instance
        s=instance(self.__class__)
        if hasattr(D(),'__init__'):
            s.__init__(*args,**keywords)
        return s

-- 
"You have to impress him! Be independent and plucky, but often do 
 things that are moronic and out of character!"
 --50s Diana Dane to 90s Diana Dane




More information about the Python-list mailing list