Die Idee: Ich bearbeite keine Klassenvariable, sondern verwende diese Variable.
Beispiel 1:
Code: Select all
class RandClass():
static_variable = "some rand value to static variable"
@classmethod
def func_that_return_string_contain_static_variable(cls):
return "some rand string" + cls.static_variable
Code: Select all
class RandClass():
static_variable = "some rand value to static variable"
@staticmethod
def func_that_return_string_contain_static_variable():
return "some rand string" + RandClass.static_variable