Python 3.7:
I have a class definition, where a class attribute is assigned a value based on the class name, and the value is used in a decorator within the class.
I'm looking for a pronoun for "the class currently being defined".
Here's an example:
class MyClass:
# NameError: name '__class__' is not defined
class_logger = find_logger(__class__.__name__)
# __init__ is not important
def __init__(self):
# This works!
self.logger = find_logger(__class__.__name__)
@mydecorator(class_logger)
# mymethod is not important
def mymethod(self):
return 1
What is a suitable pronoun for "the class currently being defined"?
(This is similar to How to get the current Python class name in __init__ regardless of the class of "self"?, but there, the question was "in the definition of init", and at the time was for 2.7. Python 3.x solved that problem.)