New syntax for blocks

r rt8396 at
Wed Nov 11 11:50:37 CET 2009

On Nov 11, 2:37 am, Steven D'Aprano
<ste... at> wrote:
> On Wed, 11 Nov 2009 00:08:58 -0800, r wrote:

> > Yea it's called a NameError. Would it not also blow up in the current
> > state of syntax usage?
> No.
> > if var:
> >     print 'var'
> > Traceback (most recent call last):
> >   File "<pyshell#45>", line 1, in <module>
> >     if var:
> > NameError: name 'var' is not defined
> You missed a line:
> var = range(N)
> if var:

Oh i get it now! If i assign a valid value to a variable the variable
is also valid...thats...thats... GENUIS! *sarcasm*

> The problem isn't the if statement, it is the conditional assignment.
> Sometimes "x as y" creates y, sometimes it doesn't, according to some
> mysterious rule something to do without whether the assignment is true or
> false, whatever that means.

i don't find True or False, Black or White, 1 or 0, Alpha or Omega to
be mysterious...? If you still cannot grasp this simple concept then i
fear i may not be able to help you understand Steven.

(snip: excessive inane blubbering)

> > No if you read my post my usage of this syntax only includes "if" and
> > "elif" constructs and nothing "else" because usage outside of such a
> > "truth-seeking" construct is pointless.
> What's so special about "truth-seeking"?
> for x in range(N) as var:
>     do_something_with(x, var)

You could do that but why would you want to. A "for x in range(N)" is
just so you can loop N times. And since changing the values in a list
whilst looping over it is the sport of fools then what usefulness
would a variable be for such a construct? You have failed to prove the
usefulness of this syntax Steven.

I suggest you go back and read over my posts again and then marinate
on the contents for a while. THEN come back with an argument based in
reality and we will try again...You know at one time i actually
considered you a formidable foe, well these times they are a chang'in
right Dylan?

More information about the Python-list mailing list