Traceback (most recent call last):
File "...\Hello Python\src\main\__init__.py", line 7, in <module>
redBench.accomodate(harold)
TypeError: unbound method accomodate() must be called with bench instance as first argument (got man instance instead)
Here is the code:
__init__py
import man_cl
import bench_cl
harold = man_cl.man("harold")
redBench = bench_cl.bench
[B]redBench.accomodate(harold)[/B]
man_cl.py
class man:
def __init__(self, name):
self.name = name
def sit(self):
print " is now sitting on bench"
bench_cl.py
class bench:
occupants = []
[B] def accomodate(self,person):
self.occupants.append(person)
print person.name + " now accomodated"[/B]
def listOccupants(self):
for i in range(1, occupants.__len__()):
print "occupant number " + i + ": " + occupant[i].name
Any ideas?