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

Steve D'Aprano steve+python at pearwood.info
Sat Oct 8 21:52:40 EDT 2016


On Sun, 9 Oct 2016 05:45 am, Random832 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.

Yes, that's what I mean. I may have worded it poorly, but if you look at a
modern Python, and compare it to 0.9.1:

py> globls
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'globls' is not defined


>>> globls
Unhandled exception: undefined name: globls
Stack backtrace (innermost last):
  File "<stdin>", line 1


the exception handling is different. As you say, exceptions are just
strings, and there's no exception hierarchy.


> The most interesting thing that I remember noticing about python 0.9.1
> is that == and != don't exist - the equality comparison operators were
> <> and a context-sensitive =.

And very limited choice for string delimiters: no raw strings, triple-quote
strings, or "".




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list