-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
This is a subtle tweak: The __new__ method is currently causing classmethod warnings (e.g., ARG003). However, it should actually be causing staticmethod warnings (e.g., ARG004).
class A:
def __new__(cls, unused_static_method_arguments):
return 42
A.__new__(A, 1) # It works!! If __new__ is treated as a class method, it should be `A.__new__(1)`NOTE: According to the official Python documentation, the __new__ method is a staticmethod that takes the class itself (cls) as its first argument.
Reference
Called to create a new instance of class cls.
__new__() is a static method (special-cased so you need not declare it as such) that takes the class of which an instance was requested as its first argument.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working