I note in PEP 3000 the proposal to remove callable(), with the comment "just
call the object and catch the exception."

I think that's a bad idea, because it takes away the ability to separate the
callability test from the first call.  As a simple example, suppose you're
writing a function that you expect to be given a function as one of its
arguments:

        def foo(bar, fun):
                assert callable(fun)
                # ...

It might be that foo doesn't actually call fun until much later.
Nevertheless, from a testing viewpoint, it would be better to detect the
error immediately of passing something that can't be called.

If you didn't have callable, how would you write this example?


_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to