Re: Class, object question.

2005-04-06 Thread harold fellermann
What I am wondering is if I have a 2nd init  or something similar to create a vector. Such as what follows and if I can how do I go about implementing it? Class vector(point): def __init___(self, point1, point2): self.i = point2.get_x() - point1.get_x() self.j = point2.get_y(

RE: Class, object question.

2005-04-05 Thread Ian Sparks
Use the *args positional-argument to catch all the positional arguments in the constructor then test them to see what you have and call a kind of sub-init based on that : class Point:     def __init__(self,x,y,z):    self.x = x    self.y = y    self.z = z   class Vector:    de