remove @staticmethod decorators

There might have been a time when calling a static method was faster
than a regular method, but that is no longer the case. According to
micro-benchmarks, it is 70% slower in CPython 3.13 and it also makes
executing the code of a class definition slower.
This commit is contained in:
Mike Fährmann
2025-06-12 22:13:46 +02:00
parent 8b6bc54e95
commit 811b665e33
68 changed files with 139 additions and 252 deletions

View File

@@ -684,8 +684,7 @@ class CustomNone():
def __call__(self, *args, **kwargs):
return self
@staticmethod
def __next__():
def __next__(self):
raise StopIteration
def __eq__(self, other):
@@ -733,20 +732,17 @@ class CustomNone():
__abs__ = identity
__invert__ = identity
@staticmethod
def __len__():
def __len__(self):
return 0
__int__ = __len__
__hash__ = __len__
__index__ = __len__
@staticmethod
def __format__(_):
def __format__(self, _):
return "None"
@staticmethod
def __str__():
def __str__(self):
return "None"
__repr__ = __str__
@@ -1052,8 +1048,7 @@ class RangePredicate():
return True
return False
@staticmethod
def _parse(rangespec):
def _parse(self, rangespec):
"""Parse an integer range string and return the resulting ranges
Examples: