return same type of object

David Isaac aisaac0 at
Tue Oct 24 16:28:23 CEST 2006

Instances of MyClass have a method that
returns another instance.  Ignoring the details
of why I might wish to do this, I could
return MyClass()
return self.__class__()

I like that latter better.  Should I?
Should I do something else altogether?

Alan Isaac

More information about the Python-list mailing list