Back
Is there a way to declare a constant in Python? In Java we can create constant values in this manner:
public static final String CONST_NAME = "Name";
What is the equivalent of the above Java constant declaration in Python?
If you are in a class, the equivalent would be:
class Foo(object): CONST_NAME = "Name"
class Foo(object):
CONST_NAME = "Name"
if not, it is just
31k questions
32.8k answers
501 comments
693 users