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

Chris Angelico rosuav at gmail.com
Sat Oct 8 21:53:08 EDT 2016


On Sun, Oct 9, 2016 at 5:45 AM, Random832 <random832 at fastmail.com> wrote:
> On Sat, Oct 8, 2016, at 07:29, Steve D'Aprano wrote:
>> The oldest version I have access to is the *extremely* primitive 0.9. Not
>> surprisingly, it doesn't have xrange -- but it lacks a lot of things,
>> including globals(), map(), named exceptions, "" strings ('' is okay),
>> exponentiation, and more.
>
> Really? I'm not sure exactly what you mean by "named exceptions", but
> 0.9.1 has RuntimeError, EOFError, TypeError, MemoryError, NameError,
> SystemError, and KeyboardInterrupt... but exceptions aren't objects,
> they're strings.
>
> They're caught by identity, though - "except 'type error'" fails to
> catch TypeError, and vice versa.

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

ChrisA



More information about the Python-list mailing list