On 16/02/2015 18:23, Marvin Humphrey wrote:
This basic approach, which should work for all hosts and be safe to embrace as
"idiomatic Clownfish", is described in the Python tutorial on user-defined
exceptions:
https://docs.python.org/3/tutorial/errors.html#tut-userexceptions
When creating a module that can raise several distinct errors, a common
practice is to create a base class for exceptions defined by that module,
and subclass that to create specific exception classes for different error
conditions...
Unfortunately, we run into a multiple inheritance problem in Python: Python's
`Exception` class has member variables, causing a clash at the offset where
the Clownfish `klass` member variable resides.
The Python tutorial also says:
> Exceptions should typically be derived from the Exception class
This sounds like it's possible to create exceptions that are not derived from
the Exception class.
Perhaps we can solve this problem by making Clownfish's exceptions under
Python wrap an host object which implements an interface, similar what to Nick
proposed back in December:
http://s.apache.org/h0K
I can't see how this would help. Most of what I proposed there wouldn't be
needed for Python anyway.
Can't we simply convert a Clownfish exception to a Python exception in
cfish_Err_do_throw (and convert it back in cfish_Err_trap)?
Nick