Remove annoying raise_with_op behaviour, document.
This adds a docstring for raise_with_op and also modifies its behaviour
somewhat. Previously, the exception was re-raised with a different
'args' member -- namely, in addition to the exception message it added
two new elements to the tuple: the Op itself and a string telling you
where in the graph the corresponding Apply node appeared.
This gets in the way if you want to have an exception message containing
formatting (newlines and tabs), since the entire tuple is printed, and
the formatting on the string is not rendered.
I've never seen the Apply node index be of use to anyone debugging, but
my proposed solution is to stash that information in __op_instance__
and __applynode_index__ on the object instead of in the args tuple.
I would not be against appending to args[0], the exception message,
with applynode information, but this is easy enough to obtain at the
pdb prompt with my modifications.
正在显示
请
注册
或者
登录
后发表评论