473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

[perl-python] 20050112 while statement

# 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);
}
Xah
xa*@xahlee.org
http://xahlee.org/PageTwo_dir/more.html

Jul 18 '05 #1
7 1385
Xah Lee wrote:
# here's a while statement in python.

[...]

# here's the same code in perl

[...]


So?
--
Michael Hoffman
Jul 18 '05 #2
"Xah Lee" <xa*@xahlee.org> writes:
# 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?)

--
Brian Raven
If you write something wrong enough, I'll be glad to make up a new
witticism just for you.
-- Larry Wall in <19*******************@wall.org>
Jul 18 '05 #3
br****@liffe.com schrieb:
"Xah Lee" <xa*@xahlee.org> writes: [...] (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. :)

--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------
Jul 18 '05 #4
Xah Lee wrote:
# 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
Jul 18 '05 #5
Steven Bethard wrote:
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
Jul 18 '05 #6
Xah Lee (xa*@xahlee.org) wrote on MMMMCLIII September MCMXCIII in
<URL:news:11**********************@f14g2000cwb.goo glegroups.com>:
... # 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
--
package Z;use overload'""'=>sub{$b++?Hacker:Another};
sub TIESCALAR{bless\my$y=>Z}sub FETCH{$a++?Perl:Just}
$,=$";my$x=tie+my$y=>Z;print$y,$x,$y,$x,"\n";#Abig ail
Jul 18 '05 #7
>>>>> "b" == brianr <br****@liffe.com> writes:

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

--
cwilbur at chromatico dot net
cwilbur at mac dot com
Jul 18 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile....
13
by: Otto J. Makela | last post by:
I'm trying to install to php the Perl-1.0.0.tgz package (from http://pecl.php.net/package/perl, enabling one to call perl libraries) to a pre-existing Solaris system. Unfortunately, the attempt...
4
by: billb | last post by:
I installed a perl extension for PHP to use some perl inside my php primarily because I have perl working with oracle and not php and oracle. So I want to use my old perl scripts, and use the...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.