Re: Nested For and While Statements

2007-09-25 Thread Gabriel Genellina
En Tue, 25 Sep 2007 14:48:29 -0300, <[EMAIL PROTECTED]> escribi�: > On Sep 25, 7:07 pm, Zentrader <[EMAIL PROTECTED]> wrote: >> Note that in list comprehension, [x for x in (1, 2, 3)], the >> for loop allocates memory the same way, but the scope changes so that >> "x" is visible outside the for lo

Re: Nested For and While Statements

2007-09-25 Thread metawilm
On Sep 25, 7:07 pm, Zentrader <[EMAIL PROTECTED]> wrote: > Note that in list comprehension, [x for x in (1, 2, 3)], the > for loop allocates memory the same way, but the scope changes so that > "x" is visible outside the for loop, How is this different? The variable spilling of list comprehension

Re: Nested For and While Statements

2007-09-25 Thread Zentrader
Scope had to do with "visibility" and not with how memory was allocated. Scope means, can this line of code access that block of memory. Note that in list comprehension, [x for x in (1, 2, 3)], the for loop allocates memory the same way, but the scope changes so that "x" is visible outside the fo

Re: Nested For and While Statements

2007-09-24 Thread metawilm
On Sep 24, 10:10 pm, Zentrader <[EMAIL PROTECTED]> wrote: > > Your for loops both use the same counting index. > > Since those variables are local to the for loop, No, "for" loops don't introduce a scope. The one variable named "j" is shared. > for j in range( 10 ): > print j, "first loop" >

Re: Nested For and While Statements

2007-09-24 Thread Ben Finney
Roberto Bonvallet <[EMAIL PROTECTED]> writes: > On Sep 24, 3:28 pm, [EMAIL PROTECTED] wrote: > > [...] where I start getting some errors. > > I'm hoping I won't have to post my code > > "Doctor, I'm feeling bad. I hope I won't have to tell you my > symptoms. What do I have?" > > Please provide

Re: Nested For and While Statements

2007-09-24 Thread Paul Hankin
First the bugs... On Sep 24, 9:52 pm, [EMAIL PROTECTED] wrote: > ... > avcsasdoc = workspace + "\avcsas.txt" > ... There's quite a few cases like this where you don't escape backslashes, so your filenames are mostly mangled. Here \a produces character code 7, which is definitely wrong. Eithe

Re: Nested For and While Statements

2007-09-24 Thread Paul Hankin
First the bugs... On Sep 24, 9:52 pm, [EMAIL PROTECTED] wrote: > ... > avcsasdoc = workspace + "\avcsas.txt" > ... There's quite a few cases like this where you don't escape backslashes, so your filenames are mostly mangled. Here \a produces character code 7, which is definitely wrong. Eithe

Re: Nested For and While Statements

2007-09-24 Thread richyjsm
On Sep 24, 4:52 pm, [EMAIL PROTECTED] wrote: > Here is my code, in the hopes that there is a reason why it isn't > running. Thanks guys. [code snipped] You're missing the closing parenthesis on the last line of the inner for loop. Richard -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested For and While Statements

2007-09-24 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : (snip) > My actual code has different variables, but thanks for pointing that > out. I'm so used to coding in VB, where indenting isn't a problem, so > all this indenting is new to me how Python wants it dictated. statement: block line 1 block line 2 # end state

Re: Nested For and While Statements

2007-09-24 Thread koutoo
On Sep 24, 3:44 pm, Roberto Bonvallet <[EMAIL PROTECTED]> wrote: > On Sep 24, 3:28 pm, [EMAIL PROTECTED] wrote: > > > [...] where I start getting some errors. > > I'm hoping I won't have to post my code > > "Doctor, I'm feeling bad. I hope I won't have to tell you my > symptoms. What do I have?"

Re: Nested For and While Statements

2007-09-24 Thread Roberto Bonvallet
On Sep 24, 3:28 pm, [EMAIL PROTECTED] wrote: > [...] where I start getting some errors. > I'm hoping I won't have to post my code "Doctor, I'm feeling bad. I hope I won't have to tell you my symptoms. What do I have?" Please provide the actual errors and the actual code. It is easier, less err

Re: Nested For and While Statements

2007-09-24 Thread koutoo
On Sep 24, 3:01 pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Sep 24, 2:28 pm, [EMAIL PROTECTED] wrote: > > > > > > > I start my code with some constants then a while statement. But I > > have some For statements towards the end within the While statement > > where I start getting some errors.

Re: Nested For and While Statements

2007-09-24 Thread Zentrader
In addition, "for" is lower case, i.e not "For". If this doesn't solve the problem then please post the actual error message. "Next Line hits snag here? Where should this line be?" is not specific enough. -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested For and While Statements

2007-09-24 Thread Zentrader
> Your for loops both use the same counting index. Since those variables are local to the for loop, theoretically it should work with both loops using the same variable. Although bad practice, I tested it on my machine and the following code does indeed work as expected, so it appears that the pr

Re: Nested For and While Statements

2007-09-24 Thread Paul McGuire
On Sep 24, 2:28 pm, [EMAIL PROTECTED] wrote: > I start my code with some constants then a while statement. But I > have some For statements towards the end within the While statement > where I start getting some errors. I'm hoping I won't have to post my > code, but it looks something like this:

Re: Nested For and While Statements

2007-09-24 Thread James Stroud
[EMAIL PROTECTED] wrote: > I start my code with some constants then a while statement. But I > have some For statements towards the end within the While statement > where I start getting some errors. I'm hoping I won't have to post my > code, but it looks something like this: > > Import os, stri

Nested For and While Statements

2007-09-24 Thread koutoo
I start my code with some constants then a while statement. But I have some For statements towards the end within the While statement where I start getting some errors. I'm hoping I won't have to post my code, but it looks something like this: Import os, string while this: All Code indent