In article <[EMAIL PROTECTED]>,
 Steven D'Aprano <[EMAIL PROTECTED]> wrote:

> try:
>      for item in obj:
>          do_stuff(item)
> except TypeError, msg:
>      if msg == "iteration over non-sequence":
>          handle_non_iterator()
>      else:
>          # re-raise the exception
>          raise

That's the obvious solution, but it's a poor one because it depends on an 
undocumented feature of the language.  What's documented is that TypeError 
is raised; it's not documented what the text of the message will be.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to