[Python-ideas] Add a "hasmethod()" builtin?
steve at pearwood.info
Thu Aug 30 06:28:25 CEST 2012
On Wed, Aug 29, 2012 at 03:48:01PM -0700, Guido van Rossum wrote:
> There's a concept that's sometimes useful when explaining behavior of
> certain Python operations in terms of simpler ones, and it is "does
> the class of x define a method m?".
It's not just methods where this is useful. For example, the help()
quasi-builtin ignores instance attribute x.__doc__ and instead uses
I'm not sure that needing this is common enough to justify builtins, but
I think it would be useful to have hastypeattr and friends (get*, set*
and del*) in the operator module.
More information about the Python-ideas