While trying to answer a question in the IRC channel today, I was
poking around in the template system and noticed that resolve_variable
has a comment about a particularly odd "gotcha": because it catches
and silently hides a TypeError raised by calling a method without the
appropriate number of arguments, it also ends up catching and silently
hiding a TypeError raised by something going wrong within the method
Out of curiosity, what's the reasoning for this? Would we incur a
significant performance penalty by looking at the exception to see
whether it's complaining about the number of arguments (in which case
it should not propagate) or whether something else has gone wrong and
raised a TypeError (in which case the exception probably should
propagate and result in a 500 error)?
"May the forces of evil become confused on the way to your house."
-- George Carlin