I ran across this case of UnboundLocalError recently, which seems strange:
import pprint
def main():
if \'pprint\' in globals(): print \'pp
Where's the surprise? Any variable global to a scope that you reassign within that scope is marked local to that scope by the compiler.
If imports would be handled differently, that would be surprising imho.
It may make a case for not naming modules after symbols used therein, or vice versa, though.