David Isaac wrote:
> 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()
> or
> return self.__class__()
> 
> I like that latter better.  Should I?
> Should I do something else altogether?
>  
The latter solution is more Pythonic, IMHO, as it works for subclasses.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to