[13106] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 516 Volume: 9

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

Date: Fri, 13 Aug 1999 19:10:12 -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: 516

Today's topics:
    Re: Why use Perl when we've got Python?! (Donovan Rebbechi)
    Re: Why use Perl when we've got Python?! (John Stevens)
    Re: Why use Perl when we've got Python?! (John Stevens)
    Re: Why use Perl when we've got Python?! (Sam Holden)
    Re: Why use Perl when we've got Python?! (John Stevens)
    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>
    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>
    Re: Why use Perl when we've got Python?! (John Stevens)
    Re: Why use Perl when we've got Python?! (John Stevens)
    Re: Why use Perl when we've got Python?! <jstevens@basho.fc.hp.com>
    Re: Why use Perl when we've got Python?! (John Stevens)
    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?! (John Stevens)
    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>
    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>
    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 21:33:13 -0400
From: elflord@news.newsguy.com (Donovan Rebbechi)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r9hqo.aik.elflord@panix3.panix.com>

On Fri, 13 Aug 1999 17:30:09 -0600, John W. Stevens wrote:

>Consider using the Perl module for FTP operations that *DON'T* conform
>to standard usage. . .

Which kinds of operations ? I haven't had any problem using the perl
module for any operations ( and I have written a simple GUI ftp client
with perl ) 

You can use the quot method to send anything you please to the server.

Cheers,
-- 
Donovan


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

Date: Sat, 14 Aug 1999 01:35:29 GMT
From: jstevens@bamboo.verinet.com (John Stevens)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r9hv1.an4.jstevens@bamboo.verinet.com>

On 13 Aug 1999 16:51:59 -0700, Tom Christiansen <tchrist@mox.perl.com> wrote:
>     [courtesy cc of this posting mailed to cited author]
>
>In comp.lang.perl.misc, 
>    "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
>:OTOH, Python is perfect for the OO trained programmer who is part of
>:a team, or where the code will have to be maintained over a long
>:period of time by many different people.
>
>As is Perl.  A sound Perl OO module designed by a competent programmer
>is certainly up to fitting that bill.

Of course!  But the issue isn't one of can it be done or not: the
issue is the average cost and the average defect rate.

>A CGI monstrosity from a 
>script kiddie isn't, but this is irrelevant.

CGI montrosities are indeed relevant, if they are written in Perl.

Somebody has to maintain them, and somebody has to pay to have them
maintained.

John S.


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

Date: Sat, 14 Aug 1999 01:41:08 GMT
From: jstevens@bamboo.verinet.com (John Stevens)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r9i9j.an4.jstevens@bamboo.verinet.com>

On 13 Aug 1999 16:50:37 -0700, Tom Christiansen <tchrist@mox.perl.com> wrote:
>     [courtesy cc of this posting mailed to cited author]
>
>In comp.lang.perl.misc, 
>    "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
>:Which makes Perl perfect for the lone programmer who comes from a
>:Unix/C/Shell background, and who has no OO training.
>
>That statement is trivially countered by demonstrating the zillions of
>Perl OO modules people, have distributed to parties unknown to them.

"Zillions"?  A slight exageration, don't you think? ;->

Besides which, absolute numbers are not comparable: show percentages,
and I'll take another look.  Show that you are talking about
OO, not just modules, and I'll take an even closer look.

>I completely disbelieve this "lone programmer" crud, and challenge you
>to defend it.

No problem.  Seen it again and again.  Somebody wants to do something,
so they drag in Perl.  They code it up in a hurry, show it to management,
and management goes: "Alright!". . . until the costs hit.

Then they start to wonder.

>I suspect that you're confusing "bad programmer" with
>"lone programmer".

Nope.  I suspect that *YOU* are confusing Joe Average Perl programmer
with yourself. . .

>A bad programmer will make code that you wouldn't
>want to try to share and reuse.  A good programmer makes good code.

Absolutley correct.  The issue, then, becomes: "with the same
programming team, who all have the same level of training and
experience with both Perl and Python, which language has the lowest
costs?"

>Please don't pretend that you can't do that in Perl, or that it hasn't
>been done.

Of course not!  The issue isn't black and white (yes it can, or not
it cannot be done), the issue is the margin, across the average.

>That there exist millions of horrible script kiddies with
>CGI written all over them doesn't change any of this.

Those millions of horrible script kiddies with CGI are
entirely relevant.  That is Perl, and it is relevant to the
discussion.

Again: what is the *AVERAGE*?

John S.


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

Date: 14 Aug 1999 01:46:27 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r9ikf.pu8.sholden@pgrad.cs.usyd.edu.au>

On Fri, 13 Aug 1999 17:30:09 -0600,
   John W. Stevens <jstevens@basho.fc.hp.com> wrote:
>Sean McAfee wrote:
>> 
>> In article <37AAFAD1.A032765B@NOSPAM.strs.co.uk>,
>> Ian Clarke  <I.Clarke@NOSPAM.strs.co.uk> wrote:
>> >I know this sounds like flame-bait, but I am genuinely curious as to
>> >what Perl might have to offer that Python doesn't.

<snip perl code - pasted in at bottom>

>The Python FTP client module is designed to be a base class, not a user
>class.
>
>Consider using the Perl module for FTP operations that *DON'T* conform
>to standard usage. . .

And which is the more common occurance? Thought so.

>My version of VIM has Python embedded in it, so I can run Python scripts
>in Vim.  You, probably, would be happier compiling in Perl.

Or just using Vim ability to shell out. Thus reducing code bloat for no
benefit, and making upgrading perl/python effect your editor which much
less effort. Allowing the system editor to use you personal development
install of perl/python, etc...

>
>Python client:
>--------------
>
>===========================================================
>#!/usr/local/bin/python
>
>#   Get FTP client module.
>from ftplib import FTP
>from sys    import exit, argv, stdout
>from string import split
>
>#   Define my FTP class.
>class myFTP(FTP):
>    def __init__(self, host, user, password):
>        FTP.__init__(self, host, user, password)
>
>    def __del__(self):
>        self.quit()
>
>    def getFile(self, file):
>        try:
>            self.retrbinary('RETR ' + file, self.spewToStdOut)
>        except Exception, ex:
>            print ex
>
>    def spewToStdOut(self, block):
>        stdout.write( block )
>
>#   Get message from command line.
>message = split(argv[0], '/')[-1:][0]
>
>#   Get host, login and password strings.
>try:
>    host     = argv[1]
>    login    = argv[2]
>    password = argv[3]
>    fileName = argv[4]
>except Exception, ex:
>    print 'Syntax Error: <command> <host> <login> <password> <file>'
>    print ex
>    exit( 1 )
>
>#   Create instance, use it.
>ftp = myFTP(host, login, password)
>
>#   Convert command to message, message to method.
>exec( "ftp.%s('%s')" %(message, fileName) )
>del ftp
>=================================================================
>
>The difference is: it would take me six lines to add a putFile method,
>while modifying your script would take longer.  Note, also, that my
>code does error checking.  Yours doesn't.

It would take one line to add a put method to the perl code, in fact you
would replace the get with a put. If you wanted to specify a command like
your python one, then you would add an eval (or set up hash, but that would
require an extra line of code).

I would be more inclined to create a seperate command for the put, since
you are unlikely to use it in the same way? In fact to be equivalent
it owuld really need to get the file from STDIN anyway. Did you read the
description of what the program was for? I snipped it sorry, but I'm
sure you remember. Making the user always type getFile or whatever it is
seems a little excessive for such a specific purpose script.

As for error checking add '|| die "error message...'" after each of the
method calls if you want fatal errors, s/die/warn/ if you don't want
fatal errors.

>
>Also, note that your code is not portable.  Mine is: it runs the same
>under NT as it does under Unix, though of course, you must run it
>from a command line environment on NT.

It doesn't work under Unix of course. Unless you consider broadcasting your 
password to everyone who can be  bothered running 'ps' working. Of course 
you would save the' unportable' part of the perl script and half the
code if you set it up to use the same incrediblyu stupid way of getting a 
password.

In fact the perl code running in NT will work just as well as yours. It
will broadcast the password to everyone looking at the screen, but so will
yours. Please explain how the perl code is not portable given that it
will do just what the python code will do?

The only Unix specific part of the perl code was the two system() calls.
The only thing they did was turn echo off and on. Since the python
program doesn't do that the python program doesn't work - it doesn't
fulfill the spec.

Those system()s can be removed bu using the Term::ReadKey module of course,
but since the script was written for a specific purpose on a Unix box, the
author felt no need. Adding it later when it needed to be moved somewhere
else would take all of 5 seconds.

<snip some liner crap>

>
>Obviously, if your job isn't programming, but instead one liners are
>what you
>do, Perl is better.

Most real programmers I know spend a reasonably large amount of their time
writing one liners to automate the things they need to do as part of their 
work.

>
>> Oh, and there's also the fact that Perl is faster than Python at darn near
>> everything.  That's the icing on the cake.
>
>That would count . . . IF it were true, and IF you have MegaBytes of
>data to
>process.  But I thought you said that you use mostly one liners?

The length of the code has no relation to the size of data?

The last one liner I wrote operated on a 112Mb squid cache index.

I must agree though that speed is irrelevant in a comparison of perl and
python. If it was we would all be using C.

code snippage place here :

>> ======================================================================
>> #!/usr/local/bin/perl
>> 
>> use Net::FTP;
>> 
>> @ARGV == 3 || die;
>> ($host, $userID, $file) = @ARGV;
>> 
>> system("stty -echo");
>> chomp($passwd = <STDIN>);
>> system("stty echo");
>> 
>> $ftp = new Net::FTP $host;
>> login $ftp $userID, $passwd;
>> get   $ftp $file, \*STDOUT;
>> quit  $ftp;
>> ======================================================================
>> 

-- 
Sam

In case you hadn't noticed, Perl is not big on originality.
	--Larry Wall


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

Date: Sat, 14 Aug 1999 01:51:55 GMT
From: jstevens@bamboo.verinet.com (John Stevens)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r9itr.an4.jstevens@bamboo.verinet.com>

On 13 Aug 1999 16:55:30 -0700, Tom Christiansen <tchrist@mox.perl.com> wrote:
>     [courtesy cc of this posting mailed to cited author]
>
>In comp.lang.perl.misc, 
>    "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
>:Understanding somebody elses Perl. . . now that can be heart breakingly
>:difficult.
>
>Then they were a bad Perl programmer, or else you are.

Don't just assert, Tom, prove it! ;->

And, again, we aren't talking "lone programmer" here, we are talking
about a *sample* (admittedly, not a totally random sample).

Nor are we talking about me.  However, the ability to become a
"Good Python Programmer" with much less time than it takes to
become a "Good Perl Programmer" is, in itself, a comment on Perl.

>Perl doesn't force
>you to write good code any more than English forces to write good prose.

Modeling Perl after Enlish is, in fact, part of the problem.

As any manager can atest, Enlish is not the best possible language
to communicate tasks and expectations in.

>When you find bad prose, whom do you shoot?  The writer, not the language.

Sorry, but that is the wrong issue: when you find bad *FORMATTING*,
who do you blame?  When you find that two different languages have
a wildly different level of "required effort" to learn to read
and understand, who do you blame?  When you find two different
languages that have wildly different defect rates, who do you blame?

Are you trying to say that language and clarity are independent?
That language and visual acuity are independent?  Sorry, but that
is just plain wrong.

>If it is counted against Perl fault that "stupid" people can program in
>Perl, then so be it.

No, it is counted against Perl that competent, mildly experienced
programmers take so long to learn Perl, and have high defect rates
when using Perl, and have so much problem maintaining other people's
code.

The learning curve for Perl is steeper and longer than that of
Python.

>This aspect has made many people's lives better,
>even if they are too "stupid" or too "inexperienced" for a "real
>programming language".  They got their job done, and they're happy.

The person who has to pay for this, however, is not.

>I doubt you want to maintain their code, but why did you hire someone to
>write professionally maintainable code who had no demonstrated ability
>to do so?

Your premise is flawed.

Your response is a standard variant of "blame the user".

John S.


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

Date: 13 Aug 1999 19:53:40 -0700
From: "John W. Stevens" <jstevens@basho.fc.hp.com>
To: tchrist@mox.perl.com
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b4cc24@cs.colorado.edu>

> 
>      [courtesy cc of this posting mailed to cited author]
> 
> In comp.lang.perl.misc, 
>     "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
> :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.
> 
> Proof my assertion, eh?  I disbelieve.  I want to see quantifiable,
> reproducible, and consequently irrefutable proof that Perl code that I
> did not write is harder for me to read than Python code I did not write.

Been there, done that.

No matter what I said, you would disbelieve.

That's Ok.  Every language needs its proponents.

I've done the test often enough, with enough different groups to
be confident in my statement (assuming that you understand that
"you" means the average programmer, not you, Tom).

John S.



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

Date: 13 Aug 1999 19:53:42 -0700
From: "John W. Stevens" <jstevens@basho.fc.hp.com>
To: tchrist@mox.perl.com
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b4cc26@cs.colorado.edu>

> 
>      [courtesy cc of this posting mailed to cited author]
> 
> In comp.lang.perl.misc, 
>     "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
> :Which begs the question: Just how many of you Perl II (Perl 5.003, is
> :it?)
> :programmers are writing OO-Perl?
> 
> What the heck is "Perl II"?  

Perl 5 is not just Perl 4 with a few changes.  It's darn near a
new language, hence: Perl II (you know, like Modula 2, then Modula 3?).

> And what is "OO-Perl"?

Object Oriented Perl.

> How many of us write new OO libraries?
> Use existing OO libraries?  What?

Any or all of the above.

John S.



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

Date: 13 Aug 1999 19:53:46 -0700
From: "John W. Stevens" <jstevens@basho.fc.hp.com>
To: tchrist@mox.perl.com
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b4cc2a@cs.colorado.edu>

> In comp.lang.perl.misc, 
>     "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
> :It comes down to the issue we discussed once before: Python is the
> :better language for [YOUR NEWSREADER SCREWED THIS UP]
> :OO, and I write OO most of the time.  I know you disagree.  But my
> :students, [YOUR NEWSREADER SCREWED THIS UP]
> :in general, also believe that Python is a better OO scripting language
> :than [YOUR NEWSREADER SCREWED THIS UP]
> :Perl.
> 
> What's a "scripting" language, for goodness sake?

A scripting language?  Read Ousterhout's paper on the subject.

Admittedly, the classifications are not sharply bounded.

John S.



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

Date: 13 Aug 1999 19:53:48 -0700
From: "John W. Stevens" <jstevens@basho.fc.hp.com>
To: tchrist@mox.perl.com
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b4cc2c@cs.colorado.edu>

> In comp.lang.perl.misc, 
>     "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
> :Perl actually seems to be a *SURRENDER* to real-live-languages.  This
> :makes [YOUR NEWSREADER SCREWED THIS UP]
> :it easier to code in *YOUR* way
> :(there-is-always-more-than-one-way-to-do-it), [AND THIS ONE]
> :but this (just like natural language) provides greater opportunities for
> :confusion and ambiguity in the mind of the reader.
> 
> Perhaps then the problem is actually the plummeting literacy rate.

Oh, I doubt it.  The biggest problem in management is the requirement
to use a natural language to manage people (allowing for far to many
ambiguities and mis-understandings).

Illiteracy doesn't help, of course.  But I don't think it is the
root problem.

John S.



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

Date: 13 Aug 1999 19:53:49 -0700
From: "John W. Stevens" <jstevens@basho.fc.hp.com>
To: tchrist@mox.perl.com
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b4cc2d@cs.colorado.edu>

> In comp.lang.perl.misc, 
>     "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
> :OTOH, Python is perfect for the OO trained programmer who is part of
> :a team, or where the code will have to be maintained over a long
> :period of time by many different people.
> 
> As is Perl.

That turns out not to be the case.  In three projects that started
out in Perl, two were eventually converted to Python, for just that
reason: Python is the much better choice for those kinds of tasks.

> A sound Perl OO module designed by a competent programmer
> is certainly up to fitting that bill.

That turns out, again, not to be the case.  Unless, of course, you
define competent in a self-referential fashion.

John S.



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

Date: 13 Aug 1999 19:53:51 -0700
From: "John W. Stevens" <jstevens@basho.fc.hp.com>
To: tchrist@mox.perl.com
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b4cc2f@cs.colorado.edu>

> In comp.lang.perl.misc, 
>     "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
> :Understanding somebody elses Perl. . . now that can be heart breakingly
> :difficult.
> 
> Then they were a bad Perl programmer, or else you are.

You are so big on assertion vs. proof: so prove the above.  If you
can.

> Perl doesn't force
> you to write good code any more than English forces to write good prose.
> When you find bad prose, whom do you shoot?  The writer, not the language.
> So, too, with Perl.  

Comparing Perl to English, and trying to emulate English, is in fact the
basis for Perl's flaws.

But the discussion was aimed more at "typesetting" not at "prose".

When you find bad typesetting, who do you shoot?  The system that
encourages/allows bad typesetting.  In this case, the flawed system
is Perl.

> If it is counted against Perl fault that "stupid" people can program in
> Perl, then so be it.

That is your mouth . . . this is mine.  I said nothing, ever, about
stupid programmers.

My criticism goes towards what should be obvious: slang can and does
make it more difficult to understand what others are saying, until
you learn that slang.  The more slang (the more variants allowed)
the more difficult a language is to learn.

Just ask any non-native speaker who is trying to learn American English.

> This aspect has made many people's lives better,
> even if they are too "stupid" or too "inexperienced" for a "real
> programming language".

Oh, Perl is as close to a real programming language as you can get. . .
assuming you subscribe to Porters definition of a "real programmer"! ;->

> They got their job done, and they're happy.

"They" may be happy.  Their team members are another story.

> I doubt you want to maintain their code, but why did you hire someone to
> write professionally maintainable code who had no demonstrated ability
> to do so?

In point of fact, when the projects mentioned before were shifted to
Python, three things happened:

1) Productivity went up.
2) Defects went down.
3) Maintenance costs went down.

Maybe it is Python that is easier for stupid programmer to use, not
Perl?

John S.



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

Date: Sat, 14 Aug 1999 01:54:33 GMT
From: jstevens@bamboo.verinet.com (John Stevens)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r9j2m.an4.jstevens@bamboo.verinet.com>

On 13 Aug 1999 16:57:33 -0700, Tom Christiansen <tchrist@mox.perl.com> wrote:
>In comp.lang.perl.misc, 
>    "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
>:>     @array = ("fred", "wilma", "barney", "betty");
>:>     %hash  = @array;
>:> Is the same as:
>:>     %hash  = ("fred", "wilma", "barney", "betty");
>:> Because the list stored in the array will have its key-value pairs
>:> re-interpreted when this is stored into the hash.
>:
>:Resulting, again, in someting confusing to the programmer who
>:hasn't any idea of what the above does, and that is still
>:somewhat confusing even to an intermediate Perl programmer.
>:
>:I can *guess*, from my Perl experience, that this creates a hash whose
>:keys are the elements of the list, and that the data elements
>:mapped to those strings are . . . wait a minute, I'm not absolutely
>:sure.
>:
>:Let me try it. . . Ok, the data elements are set to either an integer
>:zero, or a string whose contents are the zero character, or a floating
>:point zero.
>
>Goodness no, it doesn't mean that at all.  Key-value pairs, dude.

Yes.  Thank you.  That is exactly my point.

John S.


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

Date: Sat, 14 Aug 1999 01:59:09 GMT
From: jstevens@bamboo.verinet.com (John Stevens)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r9jbd.an4.jstevens@bamboo.verinet.com>

On 13 Aug 1999 17:00:52 -0700, Tom Christiansen <tchrist@mox.perl.com> wrote:
>     [courtesy cc of this posting mailed to cited author]
>
>In comp.lang.perl.misc, 
>    "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
>:> For example, that's one reason why when you want numeric ordering you
>:> use "==", but when you want lexical ordering you use an operator that
>:> looks completely different: "eq".
>:
>:This is a bad thing, not a good thing.  Again, it fails to be
>:polymorphic, to say nothing about failing to be OO.
>
>Wrong.  I can assure you that not falling into the OO trap is considered
>a strength not a weakness.

Prove, don't just assert (or, to be fair, stop telling me to
prove).

Prove that OO is a "trap".

Prove that not being OO is a strength, not a weakness.

>You obviously have been under the altar
>sipping at the communion wine at the Church of the Holy Object, whose
>credo is "I am Object -- the way, the truth, and the light.  Let no man
>come unto his data save through Me."  

Personal attacks?  Cool.

>Thank you, but Perl isn't going to force such idolatry down anyone's
>throat, and the fact that it doesn't force them down on their knees
>in worship of Lord Object cannot be counted against it.  

Wrong.  Perl does indeed force something down your throat.  It
isn't OO . . . 

>You've got them if you want them.  You don't have them if you don't
>want them.  We call it "free will".  *THIS* is a a feature.

Python, too, can be used sans OO (except where you deliberately
use an existing class, but of course, that applies to Perl as
well).

>"Unix is the answer, but only if you phrase the question very carefully."

That reminds me of another sig:

"Perl.  Just what you would expect, from some one who cannot spell."

or

"Python.  Just say: EEK! . . . "

John S.


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

Date: 13 Aug 1999 20:01:12 -0700
From: "John W. Stevens" <jstevens@basho.fc.hp.com>
To: tchrist@mox.perl.com
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b4cde8@cs.colorado.edu>

> In comp.lang.perl.misc, 
>     "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
> :>     @array = ("fred", "wilma", "barney", "betty");
> :>     %hash  = @array;
> :> Is the same as:
> :>     %hash  = ("fred", "wilma", "barney", "betty");
> :> Because the list stored in the array will have its key-value pairs
> :> re-interpreted when this is stored into the hash.
> :
> :Resulting, again, in someting confusing to the programmer who
> :hasn't any idea of what the above does, and that is still
> :somewhat confusing even to an intermediate Perl programmer.
> :
> :I can *guess*, from my Perl experience, that this creates a hash whose
> :keys are the elements of the list, and that the data elements
> :mapped to those strings are . . . wait a minute, I'm not absolutely
> :sure.
> :
> :Let me try it. . . Ok, the data elements are set to either an integer
> :zero, or a string whose contents are the zero character, or a floating
> :point zero.
> 
> Goodness no, it doesn't mean that at all.  Key-value pairs, dude.

??? 

When I tried it, then unmapped back, I got some kind of zero.

So much for DWIM.  Perl didn't do what I meant, there, and I couldn't
even guess, I had to try it.

And had I run across this idiom in a Perl program, I would have had harsh
words for the author, unless the code had been heavily documented.

John S.



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

Date: Sat, 14 Aug 1999 02:02:18 GMT
From: jstevens@bamboo.verinet.com (John Stevens)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r9jh9.an4.jstevens@bamboo.verinet.com>

On 13 Aug 1999 17:02:26 -0700, Tom Christiansen <tchrist@mox.perl.com> wrote:
>In comp.lang.perl.misc, 
>    "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
>:> Likewise, because an array and a hash
>:> are, despite their interconvertibility, fundamentally different things,
>:> they *look* different.  Contrast Python's:
>:> 
>:>     b = ["alpha", "beta", "gamma"]
>:>     c = { "fred" : "wilma", "barney" : "betty" }
>:>     print "b nought is", b[0]
>:>     print "c fred is", c["fred"]
>:> 
>:> with Perl's
>:> 
>:>     @b = ("alpha", "beta", "gamma");
>:>     %c = ( "fred", "wilma", "barney", "betty");
>:>     print "b nought is", $b[0];
>:>     print "c fred is", $c{"fred"};
>:
>:Correct.  Python's behavior is preferable.  Think: operator overloading
>:in C++.
>
>You seem to equate quantifiable benefit with mere opinion.

Nope.  The benefits of OO are not opinion, they are quantifiable
benefits.

>Please work
>on that.  I don't want different things looking the same.  It sucks.
>That's an opinion.  I prefer it that way.  That doesn't make it better.

You are entitled to your opinion.

>Objects are *NOT* ipso facto the Answer.

I never said that they were *THE* answer.  And, right back at
you, Freedom is not ipso facto the Answer, either.

>Bad programmers persist.

Indeed.

John S.

[ OO Class, day one:  "A good OO programmer can write OO code in
  any sufficiently powerful language.  A bad OO programmer can't
  write OO code at all, even in Smalltalk."
]


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

Date: 13 Aug 1999 20:02:38 -0700
From: "John W. Stevens" <jstevens@basho.fc.hp.com>
To: tchrist@mox.perl.com
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b4ce3e@cs.colorado.edu>

> In comp.lang.perl.misc, 
>     "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
> :> Likewise, because an array and a hash
> :> are, despite their interconvertibility, fundamentally different things,
> :> they *look* different.  Contrast Python's:
> :> 
> :>     b = ["alpha", "beta", "gamma"]
> :>     c = { "fred" : "wilma", "barney" : "betty" }
> :>     print "b nought is", b[0]
> :>     print "c fred is", c["fred"]
> :> 
> :> with Perl's
> :> 
> :>     @b = ("alpha", "beta", "gamma");
> :>     %c = ( "fred", "wilma", "barney", "betty");
> :>     print "b nought is", $b[0];
> :>     print "c fred is", $c{"fred"};
> :
> :Correct.  Python's behavior is preferable.  Think: operator overloading
> :in C++.
> 
> You seem to equate quantifiable benefit with mere opinion.  Please work
> on that.

And you have a tendency to jump to conclusions.  The benefits are
quantifiable.  They are not opinion.  Been there, done the statistics.

> I don't want different things looking the same.

That was the point: they are not different.  Polymorphic.

> It sucks.
> That's an opinion.  I prefer it that way.  That doesn't make it better.

Your opinion is noted.  The benefits of OO, however, are not opinion.

They are indeed quantifiable.

> Objects are *NOT* ipso facto the Answer.

I never said that they were.  They provide a step in the right
direction.

> Bad programmers persist.

Indeed.

John S.



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

Date: 13 Aug 1999 20:02:55 -0700
From: "John W. Stevens" <jstevens@basho.fc.hp.com>
To: tchrist@mox.perl.com
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b4ce4f@cs.colorado.edu>

> In comp.lang.perl.misc, 
>     "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
> :> For example, that's one reason why when you want numeric ordering you
> :> use "==", but when you want lexical ordering you use an operator that
> :> looks completely different: "eq".
> :
> :This is a bad thing, not a good thing.  Again, it fails to be
> :polymorphic, to say nothing about failing to be OO.
> 
> Wrong.  I can assure you that not falling into the OO trap is considered
> a strength not a weakness.

:-)

> You obviously have been under the altar
> sipping at the communion wine at the Church of the Holy Object, whose
> credo is "I am Object -- the way, the truth, and the light.  Let no man
> come unto his data save through Me."  

I don't suppose you recognize exactly those same traits in yourself, as
you are making fun of in me?  Just a different God?

You worship at the altar of "freedom, and damn the costs or consequences!"

> Thank you, but Perl isn't going to force such idolatry down anyone's
> throat, and the fact that it doesn't force them down on their knees
> in worship of Lord Object cannot be counted against it.  

Perl does indeed "force" it's users.  It just forces something else
on them.

> You've got them if you want them.  You don't have them if you don't
> want them.  We call it "free will".  *THIS* is a a feature.

Now, just how do you use an OO Perl module, without using OO?  What is
the magic incantation to un-OO in Perl when I don't want to OO, and I'm
including an OO-Perl thingie?

Python, too, can be used as a purely procedural language, if you are
so inclined.

John S.



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

Date: Sat, 14 Aug 1999 02:03:09 GMT
From: jstevens@bamboo.verinet.com (John Stevens)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r9jit.an4.jstevens@bamboo.verinet.com>

On 13 Aug 1999 17:04:07 -0700, Tom Christiansen <tchrist@mox.perl.com> wrote:
>     [courtesy cc of this posting mailed to cited author]
>
>In comp.lang.perl.misc, 
>    "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
>:> Accessing an array and accessing a hash are different operations.
>:No, they aren't.
>:
>:That is the point of polymorphism.
>
>Genuflect when you say that.

Diss, instead of making an argument?  Cool.

>And realize that it's completely
>wrong-headed in these parts.

How so?

John S.


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

Date: 13 Aug 1999 20:03:12 -0700
From: "John W. Stevens" <jstevens@basho.fc.hp.com>
To: tchrist@mox.perl.com
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b4ce60@cs.colorado.edu>

> 
>      [courtesy cc of this posting mailed to cited author]
> 
> In comp.lang.perl.misc, 
>     "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
> :> Accessing an array and accessing a hash are different operations.
> :No, they aren't.
> :
> :That is the point of polymorphism.
> 
> Genuflect when you say that.   And realize that it's completely
> wrong-headed in these parts.

Wrong headed: as in, I don't worship at the same altar as you do?

John S.



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

Date: 13 Aug 1999 20:03:29 -0700
From: "John W. Stevens" <jstevens@basho.fc.hp.com>
To: tchrist@mox.perl.com
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b4ce71@cs.colorado.edu>

> In comp.lang.perl.misc, 
>     "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
> :Polymorphism requires both OO training, and discipline to use, but if
> :used correctly, it is very powerful.
> 
> No disagreements.  
> 
> But I can't help but wonder: Is this how you keep out 99% of the
> accidental programmers, the ones who use Perl?

Who says I keep anybody out of anything?  I teach OO.  Not C++, or
Smalltalk. . . OO.

> If you require OO training
> and discipline, then you set the bar at the gate untenably high.

An opinion.  Duly noted, of course.  But still an opinion.

> Perl remains proudly pedestrian in its roots.

What does that mean?

> It doesn't require a Computer
> Science degree to use.

Neither does Python.  But, why in heaven's name would you talk first
about competence, then state it as a benefit that Perl can be used
by the untrained?

Why, in heaven's name, would you prefer Joe Blow (who has worked for
five years as a butcher) to perform your brain surgery, to a Medical
Doctor with a degree in Neuro Surgery?

> This, too, is a feature.  Formal training is 
> optional.

   "Formal traing is optional"

Now, what defines the difference between "formal" and "informal"
training?  And, how do you figure that OO is more difficult, more
formal than what-ever-it-is that you are talking about?

John S.



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

Date: 13 Aug 1999 20:03:46 -0700
From: "John W. Stevens" <jstevens@basho.fc.hp.com>
To: tchrist@mox.perl.com
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b4ce82@cs.colorado.edu>

> In comp.lang.perl.misc, 
>     "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
> :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.
> 
> I'm sure I am perfectly capable of presenting both Perl and Python
> in such a way that the students would prefer Perl by 7 to 1 as well.

Except that in your case, it would a concious attempt to influence
the outcome.

In my case, it was not.  In fact, the first four times I did this,
I was subconciously favoring Perl.  Imagine my shock. . .

> So what?

So. . . draw your own conclusions.  I've already seen how you
structured one reply.

John S.



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

Date: 13 Aug 1999 20:04:03 -0700
From: "John W. Stevens" <jstevens@basho.fc.hp.com>
To: tchrist@mox.perl.com
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b4ce93@cs.colorado.edu>

> In comp.lang.perl.misc, 
>     "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
> :$b[ 2 ] = $c;
> :
> :> That's just fine in Perl.  It's not fine in Python, because Python
> :> won't automatically grow an array.
> :
> :'Cause it doesn't have arrays (or, at least, not built in ones).
> 
> Gosh, that's a feature.  NOT.

Perl doesn't have lists.  Python doesn't have built-in arrays.

Python, however, has an array module as part of its standard library.

I will assume that a list module is available for Perl.

I wasn't trying to compare features, I was simply pointing out
that your comparison was Apples and Oranges, and therefore at
least somewhat invalid.

John S.



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

Date: 13 Aug 1999 20:04:21 -0700
From: "John W. Stevens" <jstevens@basho.fc.hp.com>
To: tchrist@mox.perl.com
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b4cea5@cs.colorado.edu>

> In comp.lang.perl.misc, 
>     "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
> :> Instead, you need to remember to use
> :> 
> :>     a.append("delta")
> :
> :According to what you said earlier, this is better than the Perl
> :way.  Appending to a list is better, 'cause you can tell the
> :difference between adding a new element, vs. reassignment: two
> :different operations, right?
> 
> Wrong.  I am merely sticking something at a particular place.
> If that place doesn't exist yet, MAKE IT SO.  Don't make 
> me check the length first.  

Your own reply indicates that these are two different operations.

In adding, you know you will not be overwriting and existing reference.

In assignment/reassignment, you don't.  When combining the two, you
are forced to add checks to determine the difference.

> :Excuse, but the two cases are different.  One is reassignment.  The
> :other is resize-list-and-add-a-new-element.  
> 
> Don't be ludicrous.

I'm not.

FYI: I have consistently treated you with respect.  I ask only
     that you do the same.  However, this reply makes me wonder.
	 You know darn well that adding something to a container
     object is is different than putting something into an
     existing slot.

> I don't care whether something is there before.

Which goes a long way towards explaining some of those Perl
defects I was refering to in other replies. . .

> Are you telling me that python should have one syntax for
> 
>     s = "original string"
> 
> and then a different one for
> 
>     s = "a new string that replaces the old one"

A variable is not a container class instance.  Your analogy is fatally
flawed.

> It doesn't do that for dictionaries.

An acknowledged flaw in Python's orginal dictionaries, one which has
been partially solved on extraction through the addition of the get
method.  Insertion remains to be fixed, as there is some philosophical
disagreement as to the correct semantic.

> It shouldn't do so for lists.

Lists, by definition, do not have "empty", or non-existent slots, so
overloading assignment could violate the semantic of "list".  Append
is both simpler, and less error prone.

So I must strongly disagree.  The existing system is more correct.

John S.



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

Date: 13 Aug 1999 20:04:39 -0700
From: "John W. Stevens" <jstevens@basho.fc.hp.com>
To: tchrist@mox.perl.com
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b4ceb7@cs.colorado.edu>

> 
>      [courtesy cc of this posting mailed to cited author]
> 
> In comp.lang.perl.misc, 
>     "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
> :list.append( newElement )
> :
> :to Perl's closest equivalent:
> :
> :list[ $#list + 1 ] = $newElement
> 
> Don't be silly.  That's merely
> 
>     push @array, $new_element;
> 
> Although you can use the other way if you'd like.
> I hope that freedom doesn't bug you too much.

However, using a stack operation on an array that you are currently
attempting to use to represent a list provides many opportunities
for misunderstandings, and out right bugs.

John S.



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

Date: 13 Aug 1999 20:04:55 -0700
From: "John W. Stevens" <jstevens@basho.fc.hp.com>
To: tchrist@mox.perl.com
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b4cec7@cs.colorado.edu>

> 
>      [courtesy cc of this posting mailed to cited author]
> 
> In comp.lang.perl.misc, 
>     "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
> :> But the point is that Python refused to autoallocate for you.
> :
> :Excuse, but Python did indeed automatically allocate on:
> :
> :a.append( b )
> :
> :Will automatically allocate a space for a new element in the container
> :class object 'a'.
> 
> Sometimes it autoallocates on assignment.  Sometimes it doesn't.
> This is obviously inconsistent.

So much for freedom. . . and this from a Perl guru!

The differences are based on the differences between an object of
one class, vs. an object of another class.

By your reasoning, Perl is very, very inconsistent (since not every
data type supports '+').

> Perl, however, is perfectly consistent
> here across all assignment operations, and Python isn't.

Which represents a flaw in Perl.  Different classes should/must
treat "assignment" in different fashion.

> It's as clear
> as that.

Yes.  It is.

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 516
*************************************


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