[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] Should assert continue to do a LOAD_GLOBAL on AssertionError?

On the bug tracker, there's a discussion about the current behaviour of 
the assert statement, where shadowing AssertionError will change the 
behaviour of the assertion.


Currently, assert does a LOAD_GLOBAL on AssertionError, which means if 
you shadow the name, you get a different exception. This behaviour goes 
back to Python 1.5.

I'm looking for guidance here, is this the intended behaviour, or an 
accident? Should it be changed to better match other builtins?

(For example, shadowing iter doesn't effect for loops.)