@staticmethod or def function()?

Tobiah toby at tobiah.org
Wed Oct 31 11:53:15 EDT 2018


My IDE (pycharm) suggests that I mark my class methods
with @staticmethod when they don't use 'self'.  Sounds
good.  I did that then it suggested I had the option
to make a regular function instead, at the file level.
That's a possibility.  I was thinking that I'd leave
the method in the class unless it was ever also used
by another class.  What do you think?





More information about the Python-list mailing list