Issue #10518: Bring back the callable() builtin.

Approved by Guido (BDFL) and Georg (RM).
This commit is contained in:
Antoine Pitrou 2010-11-27 22:00:11 +00:00
parent dc9b17d922
commit e71362d3de
5 changed files with 61 additions and 14 deletions

View file

@ -174,8 +174,8 @@ class BoolTest(unittest.TestCase):
self.assertIs(hasattr([], "wobble"), False)
def test_callable(self):
self.assertIs(hasattr(len, '__call__'), True)
self.assertIs(hasattr(1, '__call__'), False)
self.assertIs(callable(len), True)
self.assertIs(callable(1), False)
def test_isinstance(self):
self.assertIs(isinstance(True, bool), True)