Closed laike9m closed 5 years ago
Static Methods and Class Methods are kinds of Non-data descriptors . https://docs.python.org/2/howto/descriptor.html#static-methods-and-class-methods
@willowj I know, but I care about which representation helps user the most. 99% people don't know what "Non-data descriptors" is, a "staticmethod" label definitely tells people what they need to know.
@laike9m As for behaviour, actually stacticmehod and classmethod act as fucntions, but they are implemented by Non-data descriptors. These two categorizations appeal to diffrent users .
Simple users maybe just care about the behaviour, anyway most pythoners will encouter descriptors soon or later, if they want to know more about python. And this is a good chance to take some minutes to know what descriptor is.
Most important of all. standalone lablel will be under a big risk, that it may mislead users over this fact. Its not worthwhile,
So, i deem that existed category with labeling "staticmethod" or "classmethod" is a fine solution for trade-off.
Maybe type notation is a better method to banlance this
By "type notation" do you mean function signature?
Also I don't really understand why you think this label will mislead users.
In my mind, people use dir
because they want to know what's in the inspected object, which is a shortcut compared to reading source code. @staticmethod
is what they see if they do read the source code, and that's probably the information I want pdir2
to provide. pdir2
does not aim to help people learn Python in anyway.
Though it's actually a descriptor, (I assume) people would more like to see it marked as "staticmethod".