On 7/1/2011 12:51 AM Andre Engels said...
In this case, the error message says:
NameError: global name 'bet' is not defined
Note use of the term global?
That means, at some time at the program, it is told to do something with
'bet', but there is no variable bet. And when does that happen? That too
is told: at line 124, which says:
bet.stash -= bet.wager
Go to that line and read your code yourself - what is this 'bet' of
which the stash is to be lessened by its wager? Have you told your
program that this is the value of the variable 'bet'? Where and how?
Further, because global is used, it tells you that 'bet' is not in the
local scope, nor in the global scope. Python's general scoping
resolution rule is local-global-builtin. So bet, wherever you think it
may be defined, lives in a different namespace.
See http://docs.python.org/tutorial/classes.html
Emile
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor