Exceptions, assigning a tuple

Derek Fountain nomail at hursley.ibm.com
Fri Nov 21 02:41:30 EST 2003


> The "exception parameter" is an exception object, which knows how to
> behave like a tuple.

OK, and what gives it that ability? I tried tuple(f), where f was a file
object. It gave me the contents of the file! I tried it again on an
instance of one of my own objects and got a "TypeError: iteration over
non-sequence" exception.

It must be possible to give a class the ability to present itself as a
tuple. How is that done?




More information about the Python-list mailing list