Hi all, I'm trying to understand how scopes work within a class definition. I'll quickly illustrate with an example. Say I had the following class definition:
class Abc: message = 'Hello World' def print_message(self): print message >>> instance = Abc() >>> instance.print_message() NameError: global name 'message' not defined My question is, why? message is not defined in print_message, but it is defined in the enclosing scope (the class)? Thanks! -- http://mail.python.org/mailman/listinfo/python-list