On Fri, Aug 17, 2012 at 11:11 PM, Matthew Love wrote:
>
> This is the error:
>
> Traceback (most recent call last):
> File "C:\Users\Matthew\Desktop\test.py", line 16, in
> print(player.inventory())
> TypeError: 'list' object is not callable
>
>
The python debugger can also give you a hint
On 17/08/12 21:11, Matthew Love wrote:
class Player(object):
def inventory(self):
self.inventory = ["torch"]
return self.inventory
Notice that you override the name inventory.
Initially self.inventory is the inventory() method.
But then you change self.inventory to be a
On Fri, Aug 17, 2012 at 4:11 PM, Matthew Love
wrote:
> def inventory(self):
> self.inventory = ["torch"]
> return self.inventory
What is 'self.inventory' before you call inventory(), and what is it
afterwards? A quick fix would be to name the list "_inventory" and
return self.
This error is confusing me. I am wondering if anyone can help me out.
Using W7 64 Ultimate
Using Python 3.1.1
This is the relevant part of the program.
class Player(object):
def __init__(self):
print("Player created.")
def inventory(self):
self.inventory = ["torch"]