Static Initializer In Python
My question is similar to Is there a static constructor or static initializer in Python?. However I still don't quite follow how to implement a static constructor as I would in Jav
Solution 1:
The problem is lookupByName
is not static and expects an implicit first argument, self
. Use the staticmethod decorator in your class definition:
classTestBuilder:
...
@staticmethoddeflookupByName(name):
result = None
...
This question has more information about static methods: Static methods in Python?
Post a Comment for "Static Initializer In Python"