Python has no constant keyword, so there is no constant declaration.
Instead, there is a rule that names of constants are all capitalized and underlined (_
), which warns you if most editors assign something to a variable in an uppercase name.
Java's public static final string CONST_NAME = "Name";
is replaced by Python.
class Foo(object):
CONST_NAME = "Name"
#or
CONST_NAME = "Name"
This is.
© 2024 OneMinuteCode. All rights reserved.