Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> class A:
- ... SOME_CONSTANT = 8
- ... print(str(SOME_CONSTANT))
- ...
- 8
- >>> class A:
- ... SOME_CONSTANT = 8
- ... def go(self):
- ... print(str(SOME_CONSTANT))
- ...
- >>> a = A()
- >>> a.go()
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- File "<stdin>", line 4, in go
- NameError: global name 'SOME_CONSTANT' is not defined
- >>>
Add Comment
Please, Sign In to add comment