__init__ question
Mikael Aronsson
mikael_aronsson at mail.bip.net
Fri Aug 6 15:28:14 EDT 1999
Hi !
I have a small Python class called Vector, it is a simple 3D vector class
with an x,y and z variable.
I would like to have multiple constructors for this (like you can in C++).
Example:
a = Vector() # x=0 y=0 z=0
a = Vector( 1) # x=1 y=1 z=1
a = Vector( 1, 2, 3) # x=1 y=2 z=3
Can this be done in Python, or can I only have one __init__ method ?
Mikael
More information about the Python-list
mailing list