On 03/07/2008, Alan Gauld <[EMAIL PROTECTED]> wrote:
>  "John Fouhy" <[EMAIL PROTECTED]> wrote
> > you can instead say:
> >
> > try:
> >   foo()
> > except TypeError:
> >   # do something else
>  This makes slightly more sense, although a TypeError seems a bit
>  too vague, if it had bveen a CallableError then I'd say fine. With
>  TypeError we have a much wider chance of a problem, particularly
>  if the callable takes parameters:

Well, I'm going by something I recall reading a while ago.  TypeError
is just what you get now if you try to call something that is not
callable.  Maybe things will change?

There's some discussion here which you could read:
http://mail.python.org/pipermail/python-3000/2006-July/002619.html

(and, of course, you could always put 'callable = lambda x: hasattr(x,
"__call__")' in some utility module)

-- 
John.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to