You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
__init_subclass__ (PEP 487) should be added to WPS338 order. The resulting list would look like this:
__init_subclass__
__new__
__init__
__call__
__await__
public and magic methods
protected methods
private methods (we discourage using them)
Reasoning
In current order I see that construction and initialisation methods are given priority and ordered from instance construction to instance initialisation.
Chronologically, before all that come class construction and its initialisation. First happens in meta class, second can also be done in __init_subclass__. Therefore it naturally should come before class __new__ and __init__ methods.
Second thoughts
It might be worth considering doing the same with __class_getitem__, since it mostly used for generics construction. But since it might not be even that interesting from user perspective, I'm hesitant at proposing it.
It also should be possible to ignore specific methods by placing #noqa WPS338 at the line of their definition. But that means that reporting will also be done per method instead of current per class reporting, which can be both good (you can see what method is causing the error) and bad (there may be too many errors per class)
The text was updated successfully, but these errors were encountered:
Rule request
Thesis
__init_subclass__
(PEP 487) should be added toWPS338
order. The resulting list would look like this:__init_subclass__
__new__
__init__
__call__
__await__
Reasoning
In current order I see that construction and initialisation methods are given priority and ordered from instance construction to instance initialisation.
Chronologically, before all that come class construction and its initialisation. First happens in meta class, second can also be done in
__init_subclass__
. Therefore it naturally should come before class__new__
and__init__
methods.Second thoughts
It might be worth considering doing the same with
__class_getitem__
, since it mostly used for generics construction. But since it might not be even that interesting from user perspective, I'm hesitant at proposing it.It also should be possible to ignore specific methods by placing #noqa WPS338 at the line of their definition. But that means that reporting will also be done per method instead of current per class reporting, which can be both good (you can see what method is causing the error) and bad (there may be too many errors per class)
The text was updated successfully, but these errors were encountered: