how to refactor nested for loop into smaller for loop assume each of them independent?

Gregory Ewing greg.ewing at canterbury.ac.nz
Sun Oct 9 03:57:36 EDT 2016


Chris Angelico wrote:
> Fascinating! What about: except sys.intern('type error') ? Or does
> interning of strings not exist yet :)

Even if it was, I don't think there was any guarantee
that the "official" strings representing those exceptions
would be interned.

You were supposed to use the provided names to refer to
built-in exceptions, to make sure you were referring to the
same object.

Doing so also had the nice benefit that when exceptions
became classes, most existing exception-handling code
continued to work unchanged. It's almost like Guido had
a time machine!

-- 
Greg



More information about the Python-list mailing list