[13108] in Perl-Users-Digest
Perl-Users Digest, Issue: 518 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 13 23:17:19 1999
Date: Fri, 13 Aug 1999 20:10:14 -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: 518
Today's topics:
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@bamboo.verinet.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?! <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?! <jstevens@bamboo.verinet.com>
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?! (Eric Bohlman)
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?! (Sam Holden)
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?! (Eric Bohlman)
Re: Win32::SerialPort --> UN*X::SerialPort (William Herrera)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 13 Aug 1999 20:05: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: <37b4ced8@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:
> :Compare, also:
> :
> :list = ( "One", 1, 1.0 )
> :dict = { "Test" : list }
> :
> :t = list.append( dict )
>
> That's illegal. You've used a list operation
> on a tuple.
Yes, it is. I should have used a list, and I should have tested the
code, first.
>
> :print t[1]["test"]
> :print t
>
> Now I'm confused. The return from value from a list append
> operation is None. Are you sure you mean that? Furthermore,
> you have to "test" element, just a "Test" one.
>
> I think I'm going to assume you meant this:
>
> list = [ "One", 1, 1.0 ]
> dict = { "Test" : list }
> list.append(dict);
>
> or maybe that was
>
> t = [ list, dict ]
>
> :to the equivalent Perl code:
> :
> :Uh. . .
> :
> :Uh. . .
> :
> :Darn, I can't get my example to work (my Perl book
> :has been borrowed, while the Python example was done
> :from memory. . . I know this requires references, but
> :for the life of me, cannot remember exactly how to
> :state this)! Anybody who wants to, please show an
> :equivalent example.
> :
> :Anybody? Here's your chance to show what a Perl-DWIM-wit
> :I am. . . :-)
>
> $list = [ "One", 1, 1.0 ];
> $dict = { "Test" => $list };
>
> And then either
>
> push @$list, $dict;
>
> or else
>
> $t = [ $list, $dict ];
Thanks for the two missing magic characters (@$, and =>). I always
have to look them up.
The fact that you have a $dict that has $, instead of a %, is
very confusing.
> The bottom line is that that is hardly any different from what
> you had.
I beg to differ. The operations are the same as some other equivalent
operations, but require different syntax. . . something that you
already railed against in Python.
John S.
------------------------------
Date: 13 Aug 1999 20:05:30 -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: <37b4ceea@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:
> :> They look very different. It's obvious to the reader what's going on.
> :> They can look at %h and @a and know these are different.
> :
> :Yes. A flaw, for OO.
>
> BFD.
Yup, a big deal.
John S.
------------------------------
Date: 13 Aug 1999 20:06:08 -0700
From: John Stevens <jstevens@bamboo.verinet.com>
To: tchrist@mox.perl.com
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b4cf10@cs.colorado.edu>
In comp.lang.perl.misc, you wrote:
>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. The question isn't: can it be done? The question is:
on the average, which is better?
>A CGI monstrosity from a
>script kiddie isn't, but this is irrelevant.
Actually, they are *VERY* relevant! Those CGI monstrosities are
Perl, they go into the statistics, and somebody somewhere has to
maintain them, and somebody has to pay to get them maintained.
John S.
------------------------------
Date: 13 Aug 1999 20:06:26 -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: <37b4cf22@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:
> :Ok. I'll take that challenge. . . create for me an unreadable
> :Python program that actually compiles and runs.
>
> Ok, I just showed the paperboy some python programs, and he didn't
> think were readable at all.
"ME". The statement was: "ME".
Take that same paper boy, train him in Perl and Python at the same
time, and see which one he prefers. Go on, I'll wait. ;-)
> Please face it: terms like "readable" and "intuitive" are completely
> subjective, and therefore purely opinion.
This is incorrect. They are not subjective. They can be measured.
"Intuitive", when meant as: "leveraging off of existing learning
and habits, combined with techniques that take into account human
perceptual patterns" is both quantifiable and quite objective.
Visual acuity is, in fact, built right in to the human eye/brain.
It's not even cultural.
Since Python enforces visually acute coding practices, in general
Python will be more readable (since, whether you admit it or not,
Perl'ers span the range from using no whitespace at all, to using
wildly different mixes of indentation styles).
John S.
------------------------------
Date: 13 Aug 1999 20:06:43 -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: <37b4cf33@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:
> :And cost a lot, big time, in the real world also. The most common
> :lament from a section manager: "I've got all this Perl code that
> :<fill-in-a-name> wrote, and nobody else can understand this stuff!"
>
> I am sick and tired of the implication that because stupid people write
> stupid Perl, that Perl is stupid.
That wasn't my implication at all.
I thought I was being quite clear. Perl allows for a greater range
in expression, which allows for a greater amount of ambiguitiy,
which creates a situation where maintaining code costs much, much
more.
> Stupid people are associated with
> everything! Perl is also 100x more popular than Python -- simple because
> even stupid people *are able* to use it!
Your premise and your conclusion are not logically relatable.
Proof, please, that Perl is 100x more popular than Python?
(To prove this, you must find a random sample of people who
have used both, then prove that of those who use both equally,
that 100x as many prefer Perl).
Proof, please, that the reason Perl is more popular than Python
is due to the fact that stupid people are able to use it, while
stupid people are *NOT* able to use Python?
> And they do. And this is what
> we get for making something that even stupid people can use. I hope that
> Python should be someday cursed with one tenth the number of stupid people
> who now write Perl. Then your newsgroup can be as messy as this one.
>
> 1. Assume competence.
I do. I have noted, though, that competent people are not the same
as disciplined people. I have noted that competent people are not
always competent at everything. I have even noted that brilliance,
and the ability to created unmaintainable code are not always
mutually exclusive.
> 2. Train the ignorant.
Of course. For five years, I did just that.
> 3. Fire the stupid.
Harsh, but it works.
John S.
------------------------------
Date: 13 Aug 1999 20:07:09 -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: <37b4cf4d@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:
> :I had thought the arguments re: indentation and use of white space had
> :been settled years
> :ago. . .
>
> Don't be silly. We merely contained our laugher for the nonce.
Perhaps you should read the relevant papers from the DOD studies, the
human perception types, and the language theory types. . .
Seems pretty proven, to me.
John S.
------------------------------
Date: 13 Aug 1999 20:07:27 -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: <37b4cf5f@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, once again, not only is this not a valid criticism but in
> :point of fact Python is more correct than Perl for this
> :example.
>
> It is wrong from the Larry's principle that things that behave
> differently should have different appearances.
Then why doesn't Perl have two different operations for
assign/reassign, vs. add to an array? A tiny little violation of
Larry's principles, that.
John S.
------------------------------
Date: Sat, 14 Aug 1999 02:07:32 GMT
From: jstevens@bamboo.verinet.com (John Stevens)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r9jr4.an4.jstevens@bamboo.verinet.com>
On 13 Aug 1999 17:07:10 -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:
>: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?
I don't keep any programmers out. Especially the ones who use
Perl.
When a perl user insists on using Perl, I simply teach him to do
OO in Perl. Usually (not always, we aren't talking about absolutes,
here) they eventually switch to Python.
>If you require OO training
>and discipline, then you set the bar at the gate untenably high.
Prove that assertion, please (Pot, kettle, black, Tom?)
>Perl
>remains proudly pedestrian in its roots.
What does that mean?
>It doesn't require a Computer
>Science degree to use.
Hmm. Tom, the guy who'd prefer a butcher from Safeway to do his
brain surgery over the MD with a speciality in Neuro Surgery? ;->
All kidding aside: OO does not require a degree in computer
science, any more or less than procedural programming requires
a degree in CS.
>This, too, is a feature. Formal training is
>optional.
Please define the difference between formal and informal training?
John S.
------------------------------
Date: 13 Aug 1999 20:07:44 -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: <37b4cf70@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:
> :What you seem to be complaining about is called "polymorphism"
> :in the OO world.
>
> Perl is not about shoving an OO agenda down someone's throat.
I note, with surprise, the slant you put on my reply.
If I were to slant back, I would say that Python is not about
shoving some line-noise looking procedural agenda down somebodies
throat.
But, I won't.
Don't like OO? Fine. Don't use OO.
But if you do like OO, don't Perl.
John S.
------------------------------
Date: 13 Aug 1999 20:08:00 -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: <37b4cf80@cs.colorado.edu>
> In comp.lang.perl.misc,
> "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
> :But in a test where programmers are ignorant of each, Python is
> :the prefered choice . . . *EXCEPT* where the programmers were
> :experienced C programmers.
>
> Well what else are you going to get? BASIC programmers? Now those
> are clever folks for you! Of course most programmers are C (or C++)
> programmers.
Sigh. Not "of course". There are quite a few programmers, now, who
don't have a C/Unix background.
And, though I failed to mention it (I was trying to be a little bit
light), many of those C programmers came around after a while.
> It's the only real-world langauge that gets the jobs
> done in millions of environments. Every CompSci student should be
> proficient at C/C++. Anything else is fluff. Beneficial, but fluff.
Wow. Strong words.
I note, with some sadness, that you failed to mention Fortran or
Cobol, languages that also get the job done, in millions of
real world environments. Fortran and Cobol are fluff, hunh?
> I don't care whether they're proficient at six other languages, and
> in fact, I hope they know those six others, but C/C++ is what counts.
> What kind of "programmers" are you talking about?
Real programmers. Those who do it for a living. Some do C, others do
C++, yet others use Cobol, Fortran, Visual Basic, Objective-C, assembler,
Lisp, Prolog, Pascal, etc.
The whole world is *NOT* C.
> I think your newsreader is buggy. Better fix it.
My news reader works fine. Your news server or your news reader are
flawed. Better fix 'em. . .
John S.
------------------------------
Date: 13 Aug 1999 20:08:17 -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: <37b4cf91@cs.colorado.edu>
> In comp.lang.perl.misc,
> "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
> :Due to this feature alone, Python programs are easier to read by
> :non-authors than Perl programs are.
>
> Prove that. Stop asserting it. Prove it.
>
> Here's your challenge. Pick a Perl programmer with experience equivalent
> to mine, and show me their code.
Of course, there are very few Perl programmers that *HAVE* experience
equivalent to yours.
So doing what you suggest would prove nothing.
Perform the same test across even a randomly-selected sample, and
you will begin to see the pattern.
> I'm sure I'll find it perfectly legible.
Even for you, I doubt that. One Perl author in one of my environments
used no "unnecesary" white space at all. None. His code was
incomprehensible, even to the guy we brought in to teach Perl.
> I say this for certain because I *do* read their code, and it's completely
> easy to do so.
Yeah. Right. ;->
Been there, gathered the statistics.
> If you're talking about someone who can't stop treating Perl like
> BASIC or FORTRAN, and just doesn't `get' it, then sure, it's unnatural.
> But that's hardly my fault that they don't know Perl, now is it?
The fact that Perl lets them write unmaintainable code *IS* your
fault, when state of the art in language design can and does prevent
some of this.
What, you've never heard of a C coding style? Never seen one enforced?
Never, in your life, compared productivity levels, defect rates, and
repair costs across C or Perl code that has been written to an enforced
coding standard, vs. code that was totally free form?
Perhaps you should.
I have.
John S.
------------------------------
Date: Sat, 14 Aug 1999 02:09:34 GMT
From: jstevens@bamboo.verinet.com (John Stevens)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r9jus.an4.jstevens@bamboo.verinet.com>
On 13 Aug 1999 17:08:04 -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:
>:$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.
It is neither a feature, nor an anti-feature. The issue was raised
to point out to you that your Perl vs Python comparisons were not
valid, since you are comparing Apples and Oranges.
Note: Arrays can be used in Python. There are at least three
different Array classes that I know of.
John S.
------------------------------
Date: 13 Aug 1999 20:13:52 -0700
From: John Stevens <jstevens@bamboo.verinet.com>
To: tchrist@mox.perl.com
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b4d0e0@cs.colorado.edu>
In comp.lang.perl.misc, you 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? Are you sure that this isn't a slight exageration?
After all, if what you say re: 100x's of times more Perl users
than Python, then even if OO were a much less used paradigm on
Perl than it is on Python, you'd still expect to see more.
Most importantly: I am not talking about absolutes, here.
A obsessively quality concious, extremely disciplined, very
experienced assembly language code writer can produce highly
efficient, easily maintained code.
The issue isn't one programmer, or even examples of many, but
statistical comparisons. The existence of a body of Perl code,
being maintained by a group that has a high turn over rate,
does not invalidate my point.
Compare costs, defect rates, etc. across many such groups,
and then you will have some data to work with.
>I completely disbelieve this "lone programmer" crud, and challenge you
>to defend it.
I've seen it repeatedly. Somebody wants to do something. They
drag in Perl. They write in Perl. Management gets all hot
about it, decides to support it, then the headaches hit.
>I suspect that you're confusing "bad programmer" with
>"lone programmer".
No, I'm not. I suspect, however, that you are confusing your
level of ability with "the average Perl programmer".
>A bad programmer will make code that you wouldn't
>want to try to share and reuse.
Agreed.
>A good programmer makes good code.
Also agreed. The issue isn't the lone programmer! The issue is
*groups* of programmers: teams, in relationship to an organization.
>Please don't pretend that you can't do that in Perl, or that it hasn't
>been done.
I haven't. I won't. The issue isn't what can and cannot be done,
the issue is the margin: which is *better*, on the average? Which
has lower costs? Which has lower defect rates.
The fact that you, personally, can write low defect, highly
maintainable Perl code is not the issue: the issue is the
average programmer, in the average organization, who has the
average amount of training.
>That there exist millions of horrible script kiddies with
>CGI written all over them doesn't change any of this.
Actually, yes, it does. Think about it.
John S.
------------------------------
Date: 14 Aug 1999 02:17:23 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r9keg.pu8.sholden@pgrad.cs.usyd.edu.au>
On Sat, 14 Aug 1999 01:35:29 GMT,
John Stevens <jstevens@bamboo.verinet.com> wrote:
>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.
In that case you can't do a comparison I'm sorry. Since perl has a much
lower entry level (ie. you don't have to be an OO programmer to write
a program that actually does something useful) it has a much much much
higher proportion of non-programmers writing in it. By non-programmer I
mean someone who has not done any formal training in programming, or
on-the-job training under someone who is not a non-programmer.
There is lots of perl code written by graphic designers who decided
CGI was easy, written by teenagers whose only reference was something like
learn perl in 2 hours or perl for absolute idiots, written by people who
just learnt HTML and after getting it completely wrong decided to move
onto perl/CGI (since perl and CGI are interchangable in their minds).
Python does not have this bulk of non-programmers writing amazingly
bad code. If it did you would see amazingly bad code written in python
as often as you do in perl.
Bad code does not indicate an unmaintanable language it indicates bad
programmers, who had never even heard the words function, subroutine,
module, object, structure, data-hiding, data structures, design,
error checking, testing, etc. They just cut and paste and type monolithic
slabs of code with no form or structure. They do this in perl because it
was/is the famous CGI language. If they had heard of python it probably
wasn't installed on their $5 a month web server. If it was then they
could't find any book son it that didn't rave on about design and
programming instead of cut and pasting.
In comparison with the sheer volume of perl code produced, any study
you do comparing it with python code will end up being statistically
insignificant since there isn't enough python code.
Compare code written by professional programmers in both languages and
you have an actually useful comparison.
>
>>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.
I've seen python code that I couldn't make heads or tails of. It was
written by people who had been using python for five minutes and just
cut and paste from numerous sources. It had lots of misnamed variables.
No structure, no objects, no functions, just a massive slab of code.
I doesn't mean that python is bad, it means the author didn't know
the language and also didn't have a clue how to program.
I suppose when working out if a certain model of car is safe to drive, you
say that the car which has the highest number of accidents is the worst,
even if the real reason is because it is the most popular car on the
market and makes up 55% of all cars on the road.
Whereas, that wonderful car over their with no seat belts, no air-bags,
no side panels, and which is twice as high as it is wide and also
top heavy is the safest. Since there has only ever been 1 accident,
ignoring the fact that it has also only been driven once.
--
Sam
The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka!" (I found it!) but "That's funny ..."
--Isaac Asimov
------------------------------
Date: Sat, 14 Aug 1999 02:19:46 GMT
From: jstevens@bamboo.verinet.com (John Stevens)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r9ki2.an4.jstevens@bamboo.verinet.com>
On 13 Aug 1999 17:11:39 -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:
>:> 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.
No, you aren't. You are *CREATING* that place, and optionally,
all the places between that place and some other place, then
you are sticking something there.
Also, once again: a in the above is a list, not an array.
The semantics of a list, as defined within Python, are different
than the semantics of an array.
>If that place doesn't exist yet, MAKE IT SO. Don't make
>me check the length first.
A cause of defects. The following code:
$wordArray[ $index ] = $newWord;
Generated a core dump. The $index value was aprox. 2 billion, and
Perl happily attempted to create all of the missing elements
between the prior end-of-array, and an array of size 2 billion.
The semantics of the list object, in Python, are such that that
kind of problem is exceedingly hard to create.
>: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. Please don't personally attack me just because you
don't understand.
>I don't care whether something is there before.
Another source of Perl defects: one I've seen many times before.
>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"
Nope.
A variable is not an instance of a container class.
Different classes: different interface.
Are *YOU* trying to say that:
$result = "String One" / "test";
Should generate a result? If so, what should the result be?
Your insistence that a list should act like a dictionary
in all cases, or like a Perl array, is simply off base.
>Of course not.
>It doesn't do that for strings.
>It doesn't do that for ints.
>It doesn't do that for longs.
>It doesn't do that for floats.
>(Don't you just love all those stupid low-level numeric types?)
All of the above are, in Perl parlance, "scalars".
>It doesn't do that for dictionaries.
A dictionary is not a list.
>It shouldn't do so for lists.
Yes it should. This is proper behavior for a list.
John S.
------------------------------
Date: 14 Aug 1999 02:15:35 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <7p2jg7$2pf@dfw-ixnews7.ix.netcom.com>
John Stevens (jstevens@bamboo.verinet.com) wrote:
: On 13 Aug 1999 16:50:37 -0700, Tom Christiansen <tchrist@mox.perl.com> wrote:
:
: >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.
There is a great deal of publicly-available Perl code, particularly for
CGI tasks, and much of it is in fact dreck. In order to ascertain
whether or not that code's shittiness is a function of the language it
was written in, you'd have to compare it to an equal-sized body of code
*written to perform the same tasks* in one or more other languages;
otherwise you aren't controlling for variables other than intrinsic
properties of the language.
In particular, a lot of the shitty Perl CGI code was written between 1993
and 1995 when the Web was starting to become a Big Thing, and much of the
shitty code written afterwards involved lots of cargo-cult
cut-and-pasting from the earlier code. One possibility was that Perl was
simply the most easily-available language for writing CGI code, good or
shitty, at the time, and that that's why it got more of the dreck. If
the available body of Python CGI code is of higher quality, that could
mean nothing more than that it was written later, when CGI coding became
a more specialized task rather than something graphic designers did on
the side, and that there was no body of bad examples to borrow from.
IOW, you may be looking at what statisticians call a "period effect" (for
example, if you were to compare the average age at death of people who
died in 1998 and had computer science degrees with those who died in 1998
and had history degrees, you'd find that history majors appear to live
longer than CS majors and you could come up with some nonsensical
explanation about "electromagnetic fields." But that ignores that fact
that colleges and universities have been awarding history degrees for a
lot longer than they've been awarding CS degrees, and therefore a
randomly-chosen CS graduate is likely to be younger than a
randomly-chosen history graduate).
------------------------------
Date: Sat, 14 Aug 1999 02:23:29 GMT
From: jstevens@bamboo.verinet.com (John Stevens)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r9kp0.an4.jstevens@bamboo.verinet.com>
On 13 Aug 1999 17:12:40 -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:
>:list.append( newElement )
>:
>:to Perl's closest equivalent:
>:
>:list[ $#list + 1 ] = $newElement
>
>Don't be silly. That's merely
>
> push @array, $new_element;
Yes, it is. However, since Perl does not have a builtin
stack class (type, if you prefer), the above operation
is a cause of defects.
Since you can send messages to @array that are not valid
for a stack object, the push operation is also the
basis for those increased maintenance costs I've been talking
about.
>Although you can use the other way if you'd like.
>I hope that freedom doesn't bug you too much.
Take all the pot shots you want. Just realize that America
is the poster child for the compromise between freedom and
responsibility to the larger group.
Can you say: zoning laws? I thought you could! ;->
Perl oughta' require zoning laws. . .
John S.
------------------------------
Date: 14 Aug 1999 02:32:12 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r9la9.pu8.sholden@pgrad.cs.usyd.edu.au>
On 13 Aug 1999 20:04:03 -0700, John W. Stevens <jstevens@basho.fc.hp.com> wrote:
>> 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.
You should learn some perl you now..
@array = (1,10,20,30);
$from_list = (1,10,20,30);
$from_array = @array;
print "$from_list\n$from_array\n";
Will output :
30
4
Perl has lists, if you know perl you would know this. If you program in perl
and don't know this, then you must get very very confused at times.
>
>Python, however, has an array module as part of its standard library.
>
>I will assume that a list module is available for Perl.
No it is one of the built in bits... like hashes and arrays.
>
>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.
Only because you have no idea what you are talking about.
--
Sam
Can you sum up plan 9 in layman's terms? It does everything Unix does
only less reliably.
--Ken Thompson
------------------------------
Date: Sat, 14 Aug 1999 02:36:26 GMT
From: jstevens@bamboo.verinet.com (John Stevens)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r9lha.an4.jstevens@bamboo.verinet.com>
On 13 Aug 1999 17:14:54 -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:
>:> 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.
The above is both an assignment, *AND* an allocation.
In all cases, Python will do the same thing when executing an
assignment to a list element.
>This is obviously inconsistent.
Wrong. Different types have different semantics, requiring
different messages, and give you different results because:
they're different.
>Perl, however, is perfectly consistent
>here across all assignment operations,
Wrong.
Perl requires:
%hash = { "a" : 0 };
in one spot, while in another:
%hash = { "a" => [ "silly", "stuff" ] };
is required. Perl is consistent in allocation, but this
is only because you only implement objects whose allocation
semantic can be polymorphically represented. This is not
the case in Python. Include a list type in Perl, then show
me both correct list semantics, *AND* consistent assignment
behavior.
>and Python isn't. It's as clear
>as that.
The whole thing is a misdirection: to expect consistency
across different classes is only reasonable for that subset
of the interface that represents a shared protocol (or,
Abstract Type, if you prefer).
> Some are born to perl, some achieve perl, and some have perl
> thrust upon them.
It's that last part that costs so much.
John S.
------------------------------
Date: 14 Aug 1999 02:39:10 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r9lnb.pu8.sholden@pgrad.cs.usyd.edu.au>
On 13 Aug 1999 20:05:12 -0700,
John W. Stevens <jstevens@basho.fc.hp.com> wrote:
<snip>
>
>Thanks for the two missing magic characters (@$, and =>). I always
>have to look them up.
Learn some perl then. @ is pretty fundamental. $ is pretty fundamental.
What happens when you tell a scalr to be an array is pretty fundamental.
>
>The fact that you have a $dict that has $, instead of a %, is
>very confusing.
Only if you don't know perl. $dict is a scalar. %dict is a hash. In that
example a scalar was used.
At least in the discussions I have with people about python I don't
complain about python syntax I don't understand I just ask what it means.
Instead of calling it confusing people who actually want to learn something
ask what it means, and why it is so. You obviously don't want to
learn but only to criticise. That's fine but it would be better to just
post to the python group...
--
Sam
You can write Perl programs that resemble sed, or awk, or C, or Lisp, or
Python. This is Officially Okay in Perl culture.
--Larry Wall
------------------------------
Date: Sat, 14 Aug 1999 02:47:26 GMT
From: jstevens@bamboo.verinet.com (John Stevens)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r9m5u.an4.jstevens@bamboo.verinet.com>
On 13 Aug 1999 17:28:58 -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:
>:Compare, also:
>:
>:list = ( "One", 1, 1.0 )
>:dict = { "Test" : list }
>:
>:t = list.append( dict )
>
>That's illegal. You've used a list operation
>on a tuple.
Yup. I copied three different segments out of two different
scripts. My bad.
John S.
------------------------------
Date: 14 Aug 1999 02:55:57 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r9mmq.pu8.sholden@pgrad.cs.usyd.edu.au>
On Sat, 14 Aug 1999 02:36:26 GMT,
John Stevens <jstevens@bamboo.verinet.com> wrote:
>On 13 Aug 1999 17:14:54 -0700, Tom Christiansen <tchrist@mox.perl.com> wrote:
>
>Perl requires:
>
>%hash = { "a" : 0 };
If you like code that doesn't parse. In one line of code you show why
you don't like perl. You don't know the basics of the syntax. Assuming
you meant => or , and not : (python/perl interference is perfectly
understandable).
if you knew perl you would see %hash = { ... as being obviously wrong. {...}
creates a reference to a hash. A reference is a scalar, you can't go and
assign it to a hash.
The fact that perl uses those $,@,% symbols instantly indicates an error, and
also indicates what the author meant and how to fix it.
>
>in one spot, while in another:
>
>%hash = { "a" => [ "silly", "stuff" ] };
Again should be $ or should use (). Learn some perl before ranting and
raving about problems with the syntax of perl.
This is the same as the thing above. In the first one the value is a 0,
in the second it is a reference to a list. Where is the inconsistancy?
>
>is required. Perl is consistent in allocation, but this
>is only because you only implement objects whose allocation
>semantic can be polymorphically represented. This is not
>the case in Python. Include a list type in Perl, then show
>me both correct list semantics, *AND* consistent assignment
>behavior.
>
>>and Python isn't. It's as clear
>>as that.
>
>The whole thing is a misdirection: to expect consistency
>across different classes is only reasonable for that subset
>of the interface that represents a shared protocol (or,
>Abstract Type, if you prefer).
>
>> Some are born to perl, some achieve perl, and some have perl
>> thrust upon them.
>
>It's that last part that costs so much.
True enough, and I'm sure TomC wishes that all of the posters on
c.l.perl.m who refuse to learn and just ask FAQs ten times a day would
quit perl and move onto python.
Perl is not a suitable language for idiots and those who aren't prepared
to learn. Maybe python is, if so good on python, but that doesn't
reflect badly on perl. If python wants the idiots then please find a way
to take them. I'll start recommending them from this day on.
--
Sam
Anyway, the other successor to C gobbled up two letters instead of one.
Which is why many Perl scripts have the extension, ``.pl'', finishing
off BCPL. --Larry Wall
------------------------------
Date: Sat, 14 Aug 1999 02:59:47 GMT
From: jstevens@bamboo.verinet.com (John Stevens)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r9mt3.h3c.jstevens@bamboo.verinet.com>
On 13 Aug 1999 20:47:10 GMT, I R A Darth Aggie <fl_aggie@thepentagon.com> wrote:
>On Fri, 13 Aug 1999 13:00:22 -0600, John W. Stevens
><jstevens@basho.fc.hp.com>, in <37B46B46.80D5B51E@basho.fc.hp.com>
>wrote:
>
>+ I had thought the arguments re: indentation and use of white space had
>+ been settled years ago. . .
>
>Sure. So why is it mandatory? why isn't python permitting the programmer
>to use the whitespace deemed adequate?
Python was designed as a language for use in large, scalable systems
built by teams of programmers.
Rhetorical questions:
Have you ever worked in a C environment that defines and enforces
a C coding style?
Have you ever worked in a C environment that *didn't* define and
enforce a C coding style?
Have you ever had to maintain code that used a radically different
C coding style, or didn't use any indentation at all?
Have you ever compared maintenance costs for the same team before,
and after a C coding style was put into place?
Have you ever managed a team?
Python, by enforcing indentation, makes a minimal attempt to make
all Python code conform to a visually acute standard. This reduces
costs, both by reducing defect rates, and by reducing find-and-repair
costs for those defects that do slip by.
John S.
------------------------------
Date: 14 Aug 1999 02:55:19 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <7p2lqn$2pf@dfw-ixnews7.ix.netcom.com>
John W. Stevens (jstevens@basho.fc.hp.com) wrote:
[quoting someone whose name was lost]
: > It is wrong from the Larry's principle that things that behave
: > differently should have different appearances.
:
: Then why doesn't Perl have two different operations for
: assign/reassign, vs. add to an array? A tiny little violation of
: Larry's principles, that.
Nope. "Behave differently" hear means "accomplish two different tasks."
Comparing two strings to see if they're equal lexically is not the same
task as comparing two strings to see if they're equal numerically.
Putting a particular value in a particular position in an array that
already holds a value *is* the same task as putting a particular value in
a particular position of an array that does not yet hold a value; the
only difference is in the internal details of how to accomplish it.
Of course, the OOically-correct way to handle the string comparisons is
to define a base class, ComparableString, and two subclasses,
LexicallyComparableSting and NumericallyComparableString, along with
polymorphic operators that understand which class they're comparing to
and apply the correct comparison method. But there are cases where you
may want to do *both* comparisons on a string, and to be OC you then have
to cast the string to the appropriate type; the Perlish way of picking
the operator director is IMHO easier and more maintainable; in my
experience, heavy casting makes code unreadable.
------------------------------
Date: Sat, 14 Aug 1999 02:40:45 GMT
From: posting.account@lynxview.com (William Herrera)
Subject: Re: Win32::SerialPort --> UN*X::SerialPort
Message-Id: <37b4d6f3.45649014@news.rmi.net>
On Fri, 13 Aug 1999 15:58:19 -0400, "W. Lyle Hayhurst"
<wlhst6+@pitt.edu> wrote:
>
>Are there plans to port this module to any of
>the UN*X flavors?
>Thanks,
>Lyle
>
Done already, try perl -MCPAN -e shell;
then
install Device::SerialPort
---
The above from: address is spamblocked. Use wherrera (at) lynxview (dot) com for the reply address.
------------------------------
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 518
*************************************