Use a custom exception rather than NotImplementedError to denote missing C code
It's the second time I am in the situation where some code silently catches a NotImplementedError, assuming it is related to some Op not implementing its C code, even though this exception was raised for a totally different reason.
In some places it can probably be fixed to some extent by making sure the try / except block does not contain too much code.
However, it seems to me that a better fix would be to raise a custom exception (like NoCImplementationError).
In some places it can probably be fixed to some extent by making sure the try / except block does not contain too much code.
However, it seems to me that a better fix would be to raise a custom exception (like NoCImplementationError).
Leave a comment
on 2011-05-20 02:52 *
By james.bergstra
I basically agree with having more specific exception, but what would you like for NotImplementedError to mean in this context? What's the difference in consequences for function compilation between the c_code() function raising NotImplementedError and NoCImplementationError?
on 2011-05-20 13:09 *
By Olivier Delalleau
Replying to [comment:2 james.bergstra]:
> I basically agree with having more specific exception, but what would you like for NotImplementedError to mean in this context? What's the difference in consequences for function compilation between the c_code() function raising NotImplementedError and NoCImplementationError?
A NotImplementedError would be raised, crashing Theano.
> I basically agree with having more specific exception, but what would you like for NotImplementedError to mean in this context? What's the difference in consequences for function compilation between the c_code() function raising NotImplementedError and NoCImplementationError?
A NotImplementedError would be raised, crashing Theano.