[13095] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 505 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 13 14:17:10 1999

Date: Fri, 13 Aug 1999 11:10:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 13 Aug 1999     Volume: 9 Number: 505

Today's topics:
    Re: Why use Perl when we've got Python?! (Anno Siegel)
    Re: Why use Perl when we've got Python?! <craig@mathworks.com>
    Re: Why use Perl when we've got Python?! <tchrist@mox.perl.com>
    Re: Why use Perl when we've got Python?! (I R A Darth Aggie)
    Re: Why use Perl when we've got Python?! (I R A Darth Aggie)
    Re: Why use Perl when we've got Python?! <tchrist@mox.perl.com>
    Re: Why use Perl when we've got Python?! (Andrew Johnson)
    Re: Why use Perl when we've got Python?! <jstevens@basho.fc.hp.com>
    Re: Why use Perl when we've got Python?! <jstevens@basho.fc.hp.com>
    Re: Why use Perl when we've got Python?! <jstevens@basho.fc.hp.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 13 Aug 1999 17:07:48 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <7p1jd4$srn$1@lublin.zrz.tu-berlin.de>

Ian Clarke  <I.Clarke@strs.co.uk> wrote in comp.lang.perl.misc:
>> Some of your statements were altogether too ludicrous to contemplate an
>> earnest response. 
>
>Yet another (literally) unfounded statement!  You must understand that

C'm on, leave it alone.  You had more useful replies to your initial
query than you had a right to expect with that subject of yours.

[...]

>> You have all the trappings of the troll.
>
>Let us clarify:

No, thanks.  This was interesting for a while, but you're getting
tedious.

Anno


------------------------------

Date: Fri, 13 Aug 1999 13:08:20 -0400
From: Craig Ciquera <craig@mathworks.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37B45104.488F81B3@mathworks.com>

Skip Montanaro wrote:

> Along the lines of DWIM, the following seems to me to be a DWIMish
> shortcoming in Perl:
>
>     echo 'print "19" + "14.5";' | perl
>     33.5
>
> Python recognizes that I explicitly fed it strings:
>
>     echo 'print "19" + "14.5";' | python
>     1914.5

Isn't this strictly because Python supports operator overloading????

Big whoop!!

-Craig




------------------------------

Date: 13 Aug 1999 11:17:18 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b4531e@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    Skip Montanaro <skip@mojam.com> writes:
:Along the lines of DWIM, the following seems to me to be a DWIMish
:shortcoming in Perl:
:    echo 'print "19" + "14.5";' | perl
:    33.5
:Python recognizes that I explicitly fed it strings:
:    echo 'print "19" + "14.5";' | python
:    1914.5

What you would be misunderstanding there is the "+" operator.  That
operator in Perl means "add two numbers".  It never means concatenate
two strings.  That's what the "." operator is for.  The reason that this
happens is because of the terrible troubles we all used to experience
in awk because of the darned language trying to outguess the progammer.
It was very annoying trying to coerce things into strings by catenating
them with an empty string, or coerce them to numbers by adding 0,
merely because you wanted to specify one kind of operation or another.
It would be like the /bin/sort command not having a -n flag, but
rather always guessing how you were feeling about collation that day.
Creating completely separate and visually distinct operators for numeric
operations than were used for string operations was a deliberate and
considered technical design decision.  Check out /bin/test for another
example of the same thing.

Remember the principle of Larry's that things that act different [sic]
should look different.  I have never been used to the notion that "+"
would apply to something other than numbers.  (I guess those first hundred
thousand lines of C code I wrote ruined me for life.)  It would surprise
me if it did.  You see, "+" to me conveys numericalness, not catenation.
The argument that people say "and" for "+" doesn't get you very far
either, because then you have the bizarre situation of "&" for bitwise
and-ing being read as a "+".

--tom
-- 
    Perl programming is an *empirical* science!  
	    --Larry Wall in <10226@jpl-devvax.JPL.NASA.GOV>


------------------------------

Date: 13 Aug 1999 17:11:57 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r8kiv.2kj.fl_aggie@thepentagon.com>

On Fri, 13 Aug 1999 14:34:13 +0100, Ian Clarke <I.Clarke@strs.co.uk>, in
<37B41ED5.958C399A@strs.co.uk> wrote:

+ In the Linux world, people are talking excitedly about an
+ open Linux standard,

*distribution*

+ in fact, Linux owes much of its usefulness to the
+ fact that it conformed to the standards and style set down by Unix.

Which unix would that be?

+ Perl advocates seem to delight in the huge number of ways any task can
+ be performed (judging from comments in this thread alone), and in the
+ wonderfully convoluted code that can be produced, but in the real world,
+ where code must frequently be shared with others, freedom isn't always
+ such a good thing.

I got two words for you: CPAN.

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN/doc/FAQs/cgi/idiots-guide.html>


------------------------------

Date: 13 Aug 1999 17:18:23 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r8kv1.2kj.fl_aggie@thepentagon.com>

On Fri, 13 Aug 1999 17:33:00 +0100, Ian Clarke <I.Clarke@strs.co.uk>, in
<37B448BC.417309C0@strs.co.uk> wrote:

+ My intention is to find out about the relative merits of Perl and Python

Then get thee hence and write some perl! Then you can judge, for yourself,
with your prejudices and preferences (which you know far better than the
rest of us combined) the relative merits, and which is right for you.

I'll go out on a limb, tho: you're going to prefer Python.

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN/doc/FAQs/cgi/idiots-guide.html>


------------------------------

Date: 13 Aug 1999 11:26:39 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b4554f@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    Craig Ciquera <craig@mathworks.com> writes:
:Isn't this strictly because Python supports operator overloading????

No, not exactly.  Perl supports operator overloading on objects, too,
although this "feature" went in under some clucking from Larry, whose
experiences with it in C++ seem to have soured his view on the notion.

What's happening is that because the intrinsics in Python are object
types, you can get at different behaviours for operators whose operands
are intrinsics.  That's not how Perl works.  In Perl, they aren't.
You don't have an object of type "hash", or an object of type "array".
And a "scalar" is just a scalar, and whether it should be interpreted as
a string or a number has no impact on its being a fully-fledged object.
In fact, to be an object in Perl, it *can't* be a string or a number; it
must be a reference to something that has been blessed.  You can treat
a reference as a string or a number with "eq" or "==" respectively,
and if there's no applicable overload, those have well-defined meanings.

Differing costs and benefits can be assessed when contemplating languages
that make everything an object compared with those that don't require
you to have OO religion if you don't care for it.  Either side can 
rack up several points for both positive and negative.

:Big whoop!!

Be nice to Skip.

--tom
-- 
    "Computer Science is no more about computers than astronomy 
    is about telescopes." --E.W. Dijkstra


------------------------------

Date: Fri, 13 Aug 1999 17:29:41 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <9CYs3.1870$dr6.41851@news1.rdc2.on.home.com>

In article <7p1ic8$51h$1@nnrp1.deja.com>,
 Skip Montanaro <skip@mojam.com> wrote:
! Along the lines of DWIM, the following seems to me to be a DWIMish
! shortcoming in Perl:
! 
!     echo 'print "19" + "14.5";' | perl
!     33.5
! 
! Python recognizes that I explicitly fed it strings:
! 
!     echo 'print "19" + "14.5";' | python
!     1914.5
! 
! I believe the knife can cut both ways.

I'm on the flip side of your example ... I find the following
to be more dwimmish:

$ echo 'print "19" . "14.5"' |perl -l
1914.5
$ echo 'print 19 . 14.5' |perl -l
1914.5

$ echo 'print "19" + "14.5"' |perl -l
33.5
$ echo 'print 19 + 14.5' |perl -l
33.5

I rather like it that the concatenation operator concatenates
and the addition operator performs addition---if I say add,
then addition is WIM.

regards
andrew

-- 
      Some people, when confronted with a problem, think 'I know,
      I'll use regular expressions.'  Now they have two problems.
          -- Jamie Zawinski, on comp.lang.emacs
      


------------------------------

Date: Fri, 13 Aug 1999 11:35:29 -0600
From: "John W. Stevens" <jstevens@basho.fc.hp.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37B45761.AFBC0FCB@basho.fc.hp.com>

Ian Clarke wrote:
> 
> > Perl was originally written for a specific purpose. It's goal was to get
> > things done quickly and efficiently.
> 
> I think you could say that python was written to get things done
> quickly, efficiently, and with some hope of readability too.

Well, yes, of course!

> > Python on the other hand was written to be "tiny, elegant, minimal." I
> > am not saying this is bad. It is only different. It gives very good
> > insight into OO programming. But that's not what I, personally, want. I
> > want something to do the job, quickly and effectively.
> 
> I am not so sure that Perl is "quicker" than Python.

That depends. . . if you are doing pure-procedural-no-modules-and-no-OO
Perl,
(TC called this: stuck in Perl 4 land) then Perl is indeed faster than
Python.

If you are doing OO, though, the speed of Perl drops to about the same
as
Python, give or take a little bit.

Which begs the question: Just how many of you Perl II (Perl 5.003, is
it?)
programmers are writing OO-Perl?

> Sure, it may
> require less characters to get the same job done, but (and I admit here
> that I have never written any code in Perl) it seems that Python's more
> transparent syntax would make it easier to debug, and thus in the long
> run, Python may be quicker.

Perl source is harder to read, even for experts, and more error prone.
(Before you flame me, I know both, read both, use both, and in fact,
I learned Perl before I learned Python).

On the other hand, Python encourages you to use the OO paradigm, and
the overhead implicit in message sends can *REALLY* slow down a program.

As always, your-mileage-may-vary.

> > As far as I can see (and I might be wrong, but this is the impression I
> > got), Python was written just for the sake of writing yet another nice,
> > elegant OO language, that has a much nicer and easier syntax than C++ or
> > even Java. To that extent, Guido has succeeded. But, I believe he should
> > have concentrated on more important issues.
> 
> I disagree here.  There was a need for an interpreted scripting
> language, which allowed the development of large scalable software -
> Guido felt that Perl did not fit this bill, and I agree.  Also, while I
> am not sure which came first, Python is hardly the new kid on the block,
> it has been around for a while now.

The OO paradigm seems to support the large, scalable requirement, so
as such, both Python and Perl can now be used to build large, scalable
systems.

I would ask: what "more important issues" should Guido have
concentrated on?

Just curious. . .

> Perl seems to be more of a rebellion against good language design, and
> while people claim that this makes it "more efficient" to code in, I
> have yet to see the proof - particularly if you include the time it
> takes to debug the code.

Perl actually seems to be a *SURRENDER* to real-live-languages.  This
makes
it easier to code in *YOUR* way
(there-is-always-more-than-one-way-to-do-it),
but this (just like natural language) provides greater opportunities for
confusion and ambiguity in the mind of the reader.

> > > I have been using Python for some time now, I have occasionally looked
> > > at perl, but was but off by its seemingly counter-intuative, and
> > > over-complicated syntax.
> > That is pure FUD. Perl's syntax is very close to C's, which makes it
> > much easier to learn. I found Python's use of spaces a bit confusing,
> > but I got over it. You should try to do the same with Perl's syntax.
> 
> The first thing that hit me with Perl is that different types of
> variables require different special characters to identify them, this
> reminds me of Atari Basic of the early 80s, and is not a feature we find
> in C.  Also, I really don't think that C is the model of what the
> perfect language looks like!


And, it really isn't FUD.  It may be a bit harsh, but in classes I've
taught, programmers have more bugs, take longer to find them, and have
a harder time understanding other people's code when using Perl, than
they do when using Python.

> > If you really want to compare two languages, then you should learn them
> > both, and do the comparison yourself. I like the language which is most
> > useful to my specific set of applications. Those applications are,
> > almost surely, different from yours. So you might prefer a different
> > language.
> 
> So is your advice to everyone who posts a question to a newsgroup "Go
> find out yourself!" or is it just me?

I've tried them both.  I like them both.  I wish the OO support in Perl
II
were more explicit.  Trying to teach OO Perl is harder than it could be.

> > Also, I could care less which language you are using. But I think you're
> > missing quite a lot of fun.
> 
> I am glad you could care less, but if someone would only provide me with
> some solid reasons for why I might want to use Perl over Python (other
> than wishy washy "Perl is more efficient to code in" or "I tried Python
> and didn't like it" comments) then I might consider trying Perl.


Ian.  Try it any way.  Just for the challenge.

After all, a lot more people use Perl, than use Python, so some day
you might have to debug a Perl program.  'Sides, Perl gave us PCRE,
right?  You might say you owe them something! ;->

Just a few warnings: Your habits re: semi-colons, curly braces and,
possibly, writing OO code are going to trip you up.

John S.


------------------------------

Date: Fri, 13 Aug 1999 11:42:59 -0600
From: "John W. Stevens" <jstevens@basho.fc.hp.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37B45923.D9F13192@basho.fc.hp.com>

Kvan wrote:
> 
> Ian Clarke <I.Clarke@strs.co.uk> writes:
> 
> > Perl seems to be more of a rebellion against good language design, and
> > while people claim that this makes it "more efficient" to code in, I
> > have yet to see the proof - particularly if you include the time it
> > takes to debug the code.
> 
> The proof with a thing such as coding, and particularly debugging, can
> only be seen by doing it. Perl offers lots of debugging options, and
> is in fact one of the easiest languages I've debugged in yet.

Perls built in debugger is a plus.  I wish Python had a -d switch.

On the other hand, in small studies, Python programmers create fewer
bugs in the first place, find the ones they do create faster, and
fix them with less chance of introducing new bugs.

It's a trade off.

> Yet, many C programmers actually use a Hungarian notation anyway. In
> perl it is enforced, and allows you to quickly judge the type of
> complex constructs (it's easy to tell that @{$foo->bar("snafu")} is an
> array, even without knowing a thing about the scalar $foo). This is,
> I'll admit, quite contrary to the TIMTOWTDI philosophy of Perl, but it
> works well.

Remember, however, the reason that the Hungarian notation was developed
in the first place.

> The bottom line is that, while it may look less clean to the untrained
> eye, Perl code is actually very readable once you know how to read
> it.

This is a generically true statement: "Once you've learned how to do
it, you know how to do it."

Perl is harder to learn how to read, harder to remember how to read,
and harder to read if you, yourself, did not write it.

> This also means that you cannot fairly assess the repective merits
> of Python and Perl without knowing both fairly well--and since I don't
> know much Python (always meant to learn it, but didn't find the time
> so far), I won't get any further into this.

For short, small, throw away programs, especially if you do
pure-procedural
programming, Perl is rather nice.  And before PCRE, I prefered Perl to
Python for text processing.

With PCRE, I prefer Python.  I am slowly giving up Perl altogether,
except as a training language in OO classes.  Not to surprisingly,
Python is preferred more than 7 to 1 over Perl by students who are
exposed to both at the same time.

John S.


------------------------------

Date: Fri, 13 Aug 1999 11:44:21 -0600
From: "John W. Stevens" <jstevens@basho.fc.hp.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37B45975.CFBFDE19@basho.fc.hp.com>

I R A Darth Aggie wrote:
> 
> On Thu, 12 Aug 1999 09:31:05 +0100, Ian Clarke <I.Clarke@strs.co.uk>, in
> <37B28649.9C7F0C1E@NOSPAM.strs.co.uk> wrote:
> 
> + I am glad you could care less, but if someone would only provide me with
> + some solid reasons for why I might want to use Perl over Python (other
> + than wishy washy "Perl is more efficient to code in" or "I tried Python
> + and didn't like it" comments) then I might consider trying Perl.
> 
> Why do you need reasons to try perl? why don't you just *use* it and come
> to your own conclusion. Or how are you going to, in your words:
> 
>   How can you choose the best tool for a job, if you know nothing about
>   other tools?
> 
> James - as a fortran programmer, I can make any language unreadable...


Ok.  I'll take that challenge. . . create for me an unreadable
Python program that actually compiles and runs.

Thanks,
John S.


------------------------------

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. Due to their sizes, neither the Meta-FAQ nor
the FAQ are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq" from
almanac@ruby.oce.orst.edu. 

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 505
*************************************


home help back first fref pref prev next nref lref last post