Although any callable object can be used as a decorator, they are usually considered functions, and objects like functions should follow the lowercase_with_underscores convention.
You must hide the fact that your decorator is a class, as it is an implementation detail. Therefore, the decorator must follow the style of "lowercase_with_underscores". Thus, you do not need to change the user code if someday you decide to implement the decorator as a function.
Personally, I will still use CapWords for the (internal) decorator class name and provide an alias variable that should be used for the decorator:
class _ReferredItem: def __init__(self, method): self.method = method def __get__(self, obj, objtype):
Ferdinand beyer
source share