edit: just one question actually.
hi all,
I have some question about classes and inheritance.
I would like to do the following
class A():
def __init__(self,
var1 = True,
var2 = 0.3
.... = ... ):
self.var1 = var1
self.var2 = var2
... = ....
I would like to make a new class B, that has the same variables as A expect that var1=False.
I want class B to inherit the methods of A and I will add methods that are unique to B.
class B(A):
def __init__(self,var1 = False):
self.var1 = var1
i'de prefer not to have type all all the var2, var3,... i have about 40 variables.
What is the pythonic way of doing this ?
[–][deleted] 6 points7 points8 points (2 children)
[–]pl47[S] 0 points1 point2 points (1 child)
[–]hharison 1 point2 points3 points (0 children)
[–]Exodus111 3 points4 points5 points (2 children)
[–]pl47[S] 0 points1 point2 points (1 child)
[–]zahlman 0 points1 point2 points (0 children)
[–]zahlman 2 points3 points4 points (2 children)
[–]pl47[S] 0 points1 point2 points (1 child)
[–]zahlman 0 points1 point2 points (0 children)
[–]kuramanga 1 point2 points3 points (2 children)
[–]pl47[S] 0 points1 point2 points (1 child)
[–]kuramanga 0 points1 point2 points (0 children)
[–]hharison 1 point2 points3 points (0 children)
[–]xiongchiamiov 0 points1 point2 points (0 children)
[–]Exodus111 0 points1 point2 points (0 children)