I recently became the maintainter of PyPDF2 - a library which is pretty old and still has some code that deals with Python versions before 2.4. While I want to drop support for 3.5 and older soon, I see some parts where I'm uncertain why they were written as they are.
One example is this:
What is in the code:
class Foo(object):
def a(b, c):
print(b)
print(c)
a = staticmethod(a)
What I would expect instead:
class Bar(object):
@staticmethod
def a(b, c):
print(b)
print(c)
Is there any reason to use the first notation? Are they strictly equivalent?
I've seen that decorators were introduced in Python 2.4, so this might be an example of such extreme legacy code.