[perl-python] 20050112 while statement

B

brianr

Xah Lee said:
# here's a while statement in python.

a,b = 0,1
while b < 20:
print b
a,b = b,a+b

---------------
# here's the same code in perl

($a,$b)=(0,1);
while ($b<20) {
print $b, "\n";
($a,$b)= ($b, $a+$b);
}

That python code produces a syntax error:

File "w.py", line 3
print b
^
IndentationError: expected an indented block

So, not the same then!

(As a matter of interest, is this sequence of posts intended to
demonstrate ignorance of both languages, or just one?)
 
P

Peter Maas

(As a matter of interest, is this sequence of posts intended to
demonstrate ignorance of both languages, or just one?)

:)

This sequence of posts is intended to stir up a debate just for
the sake of a debate. It's a time sink. It's up to you wether you
want to post to this thread or do something useful. :)
 
S

Steven Bethard

Xah said:
# here's a while statement in python.

a,b = 0,1
while b < 20:
print b
a,b = b,a+b

---------------
# here's the same code in perl

($a,$b)=(0,1);
while ($b<20) {
print $b, "\n";
($a,$b)= ($b, $a+$b);
}

Because you're posting this to newsgroups, it would be advisable to use
only spaces for indentation -- tabs are removed by a lot of newsreaders,
which means your Python readers are going to complain about
IndentationErrors.

Personally, I think you should not do this over comp.lang.python (and
perhaps others feel the same way about comp.lang.perl.misc?) Can't you
start a Yahoo group or something for this? What you're doing is
probably not of interest to most of the comp.lang.python community, and
might me more appropriate in a different venue.

Steve
 
P

Peter Hansen

Steven said:
Xah Lee wrote: [some Python code]
Because you're posting this to newsgroups, it would be advisable to use
only spaces for indentation -- tabs are removed by a lot of newsreaders,
which means your Python readers are going to complain about
IndentationErrors.

Unfortunately, there are now two ways to post screwed up Python
code, and using tabs is only one of them.

The other is to post from Google Groups, and that's what Xah Lee
is doing.

(The rest of your advice, about going away, is pretty good though. ;-)

-Peter
 
A

Abigail

Xah Lee ([email protected]) wrote on MMMMCLIII September MCMXCIII in
<URL:... # here's a while statement in python.
...
... a,b = 0,1
... while b < 20:
... print b

IndentationError: expected an indented block

... a,b = b,a+b


You have already proven you don't know Perl, but now it turns
out, you don't know Python either.

Go away.


Abigail
 
C

Charlton Wilbur

b> (As a matter of interest, is this sequence of posts intended to
b> demonstrate ignorance of both languages, or just one?)

Intentional fallacy -- there's no necessary correlation between what
he *intends* to do and what he actually succeeds at doing. As noted,
Xah *intends* to use his expertise in Perl to teach Python to others.
All he's succeeding in doing is demonstrating his incompetence at
both. As for myself, I suspect it's just a cunning approach to Let's
You And Him Fight.

Charlton
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top