How to implement multiple constructors
J C Lawrence
claw at kanga.nu
Sun May 8 18:59:40 EDT 2005
tron.thomas at verizon.net wrote:
> I am a C++ developer with only a little experience using Python. I
> want to create a Python class where by I can construct an instance from
> that class based on one of two different object types.
The approaches I've seen used are to use a new class method as an
alternate ctor with a special name, and to use the types module for type
comparison within such a ctor.
--
J C Lawrence They said, "You have a blue guitar,
---------(*) You do not play things as they are."
claw at kanga.nu The man replied, "Things as they are
http://www.kanga.nu/~claw/ Are changed upon the blue guitar."
More information about the Python-list
mailing list