KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to access a static variable from a static method: #!/usr/bin/env python class Messenger: name = "world" @staticmethod def get_msg(grrrr): return "hello " + grrrr.name print Messenger.get_msg(Messenger) How to do it without passing grrrr to a method? Is this the true OOP?.. Anything like name or self.name seems not working: NameError: global name 'name' is not defined and NameError: global name 'self' is not defined
Tags (comma-separated)
Save Edits
Cancel