I want to access the variable number_of_messages in class A but I get "number_of_messages" is not defined error even though I used global keyword. Here is a code sample:
class A:
number_of_messages=0;
def inc(self):
global number_of_messages
number_of_messages+=1
print(A().inc())
incmethod returnsNone, so I would never expect your print statement to shed light on what's happening withnumber_of_messages