[Tutor] range efficiency
Danny Yoo
dyoo at hashcollision.org
Sun May 12 04:41:54 CEST 2013
On Fri, May 10, 2013 at 3:19 PM, Jim Mooney <cybervigilante at gmail.com> 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-for-statement
when it says: "The expression list is evaluated once; it should yield
an iterable object."
More information about the Tutor
mailing list