Re: [Tutor] range efficiency

2013-05-11 Thread Danny Yoo
On Fri, May 10, 2013 at 3:19 PM, Jim Mooney wrote: > If I'm using a variable-dependent range in a for loop, is Python smart > enough to figure the variable once so I don't have to hoist it up? Hi Jim, The gritty details say "yes": http://docs.python.org/2/reference/compound_stmts.html#the-

Re: [Tutor] Making a Primary Number List generator

2013-05-11 Thread Dave Angel
On 05/11/2013 04:44 PM, Daniel Magruder wrote: Dear Tutor at Python.org, I am new to the python language and have been teaching myself through various online resources. I found an exercise where I am to create a program that prints a list of the first 1000 prime numbers. After many attempts and

[Tutor] Making a Primary Number List generator

2013-05-11 Thread Daniel Magruder
Dear Tutor at Python.org, I am new to the python language and have been teaching myself through various online resources. I found an exercise where I am to create a program that prints a list of the first 1000 prime numbers. After many attempts and looking at other answers for other ways around

Re: [Tutor] Tutor Digest, Vol 111, Issue 24

2013-05-11 Thread Alan Gauld
On 11/05/13 07:51, Steven D'Aprano wrote: Pascal is still case agnostic and in that community its often seen as a benefit... Interesting that you say that. Just the other week I was reading a page somewhere talking about some Pascal compiler, and it made a comment that "by popular request" th

Re: [Tutor] range efficiency

2013-05-11 Thread eryksun
On Fri, May 10, 2013 at 5:19 PM, Jim Mooney wrote: > If I'm using a variable-dependent range in a for loop, is Python smart > enough to figure the variable once so I don't have to hoist it up? At the start of a for loop, the interpreter gets an iterator for the iterable. The latter is evaluated