Hi Scott,
> can someone tell me, how to use a class like that* (or "simulate" more
> than 1 constructor) :
One approach could be:
class myPointClass:
def __init__(self, **args):
for k, v in args.items():
setattr(self, k, v)
> *this is not homework
Just to be safe, I'll leave out the explanation :)
Regards
Steve
On 6/22/05, scott <[EMAIL PROTECTED]> wrote:
> hi people,
>
> can someone tell me, how to use a class like that* (or "simulate" more
> than 1 constructor) :
> #--
> class myPointClass:
> def __init__(self, x=0, y=0):
> self.x = x
> self.y = y
> def __init__(self, x=0, y=0, z=0):
> self.__init__(self, x, y)
> self.z = z
> #--
>
> tia people
> scott
>
> *this is not homework
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail.python.org/mailman/listinfo/python-list