Steven Bethard wrote: > Are you really using staticmethod and calling __new__? It's often much > easier to use classmethod, e.g.:: > > class Color(object): > ... > @classmethod > def from_html(cls, r, g, b): > ... > # convert r, g, b to normal constructor args > ... > # call normal constructor > return cls(...) >
I could use that for some things, but often I can avoid an intermediate step by bypassing the class constructor altogether... > And FWIW, I use lower_with_underscores for alternate constructors, not > CamelCase. Seems to be the consensus. I think I'll stick_to_it! -- http://mail.python.org/mailman/listinfo/python-list