Hello,

While writing one of my classes, I needed to factor out some bits of
functionality into private, instance-independent functions.  To avoid
supplying any extra arguments to these functions, I have made them
into static methods using the @staticmethod decorator.

However, Tom has pointed out [0] that @classmethod would be preferable
instead.  I have tried to google why that would be the case, but I
haven't managed to dig anything out.  Grepping over the source of
SymPy reveals the usage of @staticmethod on occasions almost as
numerous as those where @classmethod is used.

Is there a fixed strategy when to use one of the two decorators in
SymPy?

Sergiu

[0] 
https://github.com/scolobb/sympy/commit/603fd9e97f5b3215f3165f265a806b09fb80a830#sympy-categories-diagram_drawing-py-P6

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to