Le dimanche 07 mai 2006 à 17:47 +1200, Greg Ewing a écrit :
> Talin wrote:
> 
> > 1) Getting rid of 'callable'.
> > 
> > The reccomended replacement is "just call the object and catch the resulting
> > exception",
> 
> No, the recommended replacement should be "redesign your API
> so that you don't need to test whether something is callable".

I think callable() can be useful for defensive coding.
For example, if your function expects a callback as argument, you can
check whether the callback is really callable before actually calling it
5 minutes (or 5 days) later.

Of course, it could be part of a signature checking API: first check if
the object is callable, then if it has the right signature.


_______________________________________________
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