[TIP] Nose bug? using inspect.ismethod too aggressive?
Ben Finney
ben+python at benfinney.id.au
Sun Sep 20 21:43:54 PDT 2009
Fernando Perez <fperez.net at gmail.com> writes:
> callable() went away in Py3, so we might as well get used to the new
> idioms. No point now in writing deliberately 2.x-only code. The above
> was Guido's suggested new 'spelling' for callable(), if my memory of
> his py3k talk serves me right, though I'd be happy to be corrected.
You have it right. PEP 3100 says the correct replacement for
‘callable(x)’ is ‘hasattr(x, '__call__')’
<URL:http://www.python.org/dev/peps/pep-3100/#id105>.
--
\ “Because of the impropriety of entertaining guests of the |
`\ opposite sex in the bedroom, it is suggested that the lobby be |
_o__) used for this purpose.” —hotel, Zurich |
Ben Finney
More information about the testing-in-python
mailing list