Thanks for the feedback, there was one issue, I was using old style
classes, so to be accurate and have the example work:
class A(object):
def __init__(self, a,b):
self.a = a
self.b = b
class B(A):
def __init__(self, a, b, newVar):
super(B, self).__init__(a,b)
self.var = var
need the 'object' to instance a object in the class.
Thanks again.
On Mar 23, 10:47 am, Dado Feigenblatt <[email protected]> wrote:
> I uppercased your class names for clarity
> This is how you extend the __init__() method, by first calling it on the
> base class.
>
> class B(A):
> def __init__(self, a, b, newVar)
> super(B, self).__init__(a,b)
> self.var = var
>
> dado
>
> shawnpatapoff wrote:
> > Trying to find a better way of doing this, and it I have a solution
> > but I'm not sure it's the best one. Lets say I have a class and I want
> > to add one more variable to its __init__ when I make a new instance.
> > Right now I'm overloading the init with all its originals and adding
> > what I need. It works, but it seems there should be a better way.
>
> > eg:
> > class a():
> > def __init__(self, a,b):
> > self.a = a
> > self.b = b
>
> > class b(a):
> > def __init__(self, a, b, newVar)
> > self.a = a
> > self.b = b
> > self.var = var
>
> > That's how I'm doing now, please tell me there is a cleaner way!
>
> > Cheers,
> > Shawn
>
>
--
http://groups.google.com/group/python_inside_maya
To unsubscribe from this group, send email to
python_inside_maya+unsubscribegooglegroups.com or reply to this email with the
words "REMOVE ME" as the subject.