You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[This might be a duplicate of #7, in that it's wrong 99.9% of the time so maybe we say "that's close enough" and make anyone with a legitimate use have to use noqa once that works. In fact that'd probably be what I'd lean towards, but filing this in case it's worth discussing]
There's, I've realized, one legitimate use for @staticmethod --
If you have a module with a (normal, non-descriptor) object, and you want to replace that object with a normal function instead, the function you use likely always, but at least sometimes, should be @staticmethoded if you think that the previous object might have been being used as a class attribute by end-user code.
If you don't, when you change to a function, end-user code will break as their object suddenly becomes a descriptor and has its calling arguments changed.
The text was updated successfully, but these errors were encountered:
[This might be a duplicate of #7, in that it's wrong 99.9% of the time so maybe we say "that's close enough" and make anyone with a legitimate use have to use noqa once that works. In fact that'd probably be what I'd lean towards, but filing this in case it's worth discussing]
There's, I've realized, one legitimate use for
@staticmethod
--If you have a module with a (normal, non-descriptor) object, and you want to replace that object with a normal function instead, the function you use likely always, but at least sometimes, should be
@staticmethod
ed if you think that the previous object might have been being used as a class attribute by end-user code.If you don't, when you change to a function, end-user code will break as their object suddenly becomes a descriptor and has its calling arguments changed.
The text was updated successfully, but these errors were encountered: