Python __init__ Issue: Unbound Method __init__() Must Be Called With Bank Instance As First Argument (got Int Instance Instead)
class Teller(object): def __init__(self): self.occupied = False self.timeLeft = 0 self.totTime def occupy(self, timeOcc): self.occupied = T
Solution 1:
2 points to make here:
You shouldn't be calling
__init__directly, it's a magic method which is invoked when you construct an object like this:virtBank = Bank(3, 7)The instance is implicitly passed to the constructor, but it must be explicitly received, like this:
def __init__(self, numTellers, hoursOpen): # ...
Post a Comment for "Python __init__ Issue: Unbound Method __init__() Must Be Called With Bank Instance As First Argument (got Int Instance Instead)"