claird / PyPDF4

A utility to read and write PDFs with Python
obsolete-https://pythonhosted.org/PyPDF2/
Other
330 stars 61 forks source link

Use staticmethod() as a decorator #8

Closed acsor closed 6 years ago

acsor commented 6 years ago

Up until PyPDF2 it is very frequent to see such code snippets as:

def method(arg1, arg2, ...):
    ...

method = staticmethod(method)

within the body of a class. If we set out to support only down to Python 2.7, then we can substitute those instructions with the more concise

@staticmethod
def method(arg1, arg2, ...):
    ...

The staticmethod() feature was added in Python 2.2, and the decorator support in 2.4: source. Apparently, we are good to go. Shall I add this change into one of my future commits?

acsor commented 6 years ago

Also, what should be the style of the future invocations to staticmethod()?

acsor commented 6 years ago

This is being tackled and closed definitely by PR #9.

claird commented 6 years ago

Oscar, it's time to leave 2.6 behind. Feel free to decorate in a more natural style.

Cameron Laird, vice president We make computers work for people.

On Thu, Aug 16, 2018 at 7:57 AM, Oscar notifications@github.com wrote:

Up until PyPDF2 it is very frequent to see such code snippets as:

def method(arg1, arg2, ...): ...

method = staticmethod(method)

within the body of a class. If we set out to support only down to Python 2.7, then we can substitute those instructions with the more concise

@staticmethod def method(arg1, arg2, ...): ...

The staticmethod() feature was added in Python 2.2, and the decorator support in 2.4: source https://docs.python.org/2.7/library/functions.html#staticmethod. Apparently, we are good to go. Shall I add this change into one of my future commits?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/claird/PyPDF4/issues/8, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbN9H2oJ8HedabLRlDKlgIvW2ANGyH-ks5uRXpBgaJpZM4V_6O- .