@staticmethod, backward compatibility?

Neal Becker ndbecker2 at gmail.com
Tue Sep 27 07:20:44 EDT 2005


How can I write code to take advantage of new decorator syntax, while
allowing backward compatibility?

I almost want a preprocessor.

#if PYTHON_VERSION >= 2.4
@staticmethod
...


Since python < 2.4 will just choke on @staticmethod, how can I do this?




More information about the Python-list mailing list