Example¶
Before¶
class Example:
def _protected_instance(self):
pass
@staticmethod
def public_static():
pass
def __init__(self):
pass
@classmethod
def _protected_class(cls):
pass
def public_instance(self):
pass
def __private_method(self):
pass
@classmethod
def public_class(cls):
pass
After (with the default config)¶
class Example:
def __init__(self):
pass
def public_instance(self):
pass
@classmethod
def public_class(cls):
pass
@staticmethod
def public_static():
pass
def _protected_instance(self):
pass
@classmethod
def _protected_class(cls):
pass
def __private_method(self):
pass
The methods are now organised by:
- Visibility: creational (
__init__) → dunder → public → protected → private - Type (within each visibility): instance → class → static
See Sorting behaviour for the rules behind this ordering.