Python versus Perl ?

R

Reinhold Birkenfeld

Fredrik said:
if you use Python mostly to write empty loops, your programming license
should be revoked. the benchmark author seems to have realized that, as
can be seen from the "it's dead" paragraph at the top of the page, which
makes me wonder why you posted this link...

Especially when you read

"""
I found the performance of Python for these benchmarks really surprising
as it is at odds to my everyday experience.
"""

you will seriously think about the benchmark's significance.

Reinhold
 
M

m

real issue for your programming task (in order to continue this
discussion). Otherwise the debate will go south real quick.

Keep well
Caleb

i have nothing else to add. thanks caleb!
 
A

Adam DePrince

Hi m

Speed is a contentious issue here. Point is, if you really need raw
speed, why stop only at Perl and Python? There are plenty of statically
compiled languages that will produce native binaries.

The relative difference in speed between Perl and Python, whatever it is,
is completely washed out by the enormous jump using, say, C for example
[please, everyone else, I am aware of all the mitigating circumstances
regarding, e.g. parts of the standard library written in C, etc. That is
not my point.]

I think the expression you seek is "comparing virtue among whores."

Now we can all acknowledge that there is a spectrum in the programmer
time vs machine time trade-off. (Voice reader users: Please forgive my
ASCII art ... imagine a data set that loosely fits a linear relationship
with a negative slope.)

ASCII art start

+
M|*
A| * *
C| *
H| * "STUPID"
I| * *
N| *
E| *
| *
C| * *
O| "Holy *
S| Grail" *
T| *
0------------------------- +
PROGRAMMER COST

ASCII art stop

This metric is actually in two dimensions, but we usually consider it in
one dimension with High Machine cost and low programmer cost at one
extreme and low machine cost and high programmer cost at the other
extreme.

ASCII art start

High Machine <---------------> High Programmer Cost

ASCII art stop

because there is a high inverse correlation between programmer and
machine costs. Only a fool would use a programing language in the
"stupid" area of the above chart (both costs high). Likewise, nobody
gets to use the language that does not exist in the "Holy Grail" area of
the chart (both costs low.)

Both Python and Perl are way up in the upper left ( machine cost high,
programmer cost low) of my little chart. Perl has much magic that
drives up its programmer cost. Not by much in the know, but by enough
that I would consider it to have a slightly higher programmer cost than
Python. If Perl code executes a bit faster, then fine, all I can say is
"that's nice." If machine costs were an issue I'd recode in vhdl and
compile to silicone.

Of the topic I want to address, you can entirely circumvent those
issues by coding in C and using the Python C-API instead of strcmp and
friends.


A Good Reason for thinking along these lines (Perl/Python) is more
something like speed and reliability of development. Another one is
maintaintability. I must confess that I know pretty much nothing about
Perl, so I can't comment about that. My opinion about Python is that it
is very, very good for these things.

The problem domains in which I do most of my work (chemical process
modelling and simulation) really do require speed. That's why I mostly
use Delphi (i.e. reasonably fast code) at work. I believe I know when
speed is and is not an issue, and (by far) most of the time, my experience
is that it is *not*. So I use Delphi for numerical code and python for
everything else.

Why don't you use C for the numerical work? Then you can do your number
crunching within a c-based python module. Have your cake and ...
You really will have to convince people here that execution speed is a
real issue for your programming task (in order to continue this
discussion). Otherwise the debate will go south real quick.

Not only most speed be an issue, but the economics must be such that any
alternative is better than throwing more hardware at the problem.

Adam DePrince
 
C

Caleb Hattingh

Hi m

Speed is a contentious issue here. Point is, if you really need raw
speed, why stop only at Perl and Python? There are plenty of statically
compiled languages that will produce native binaries.

The relative difference in speed between Perl and Python, whatever it is,
is completely washed out by the enormous jump using, say, C for example
[please, everyone else, I am aware of all the mitigating circumstances
regarding, e.g. parts of the standard library written in C, etc. That is
not my point.]

A Good Reason for thinking along these lines (Perl/Python) is more
something like speed and reliability of development. Another one is
maintaintability. I must confess that I know pretty much nothing about
Perl, so I can't comment about that. My opinion about Python is that it
is very, very good for these things.

The problem domains in which I do most of my work (chemical process
modelling and simulation) really do require speed. That's why I mostly
use Delphi (i.e. reasonably fast code) at work. I believe I know when
speed is and is not an issue, and (by far) most of the time, my experience
is that it is *not*. So I use Delphi for numerical code and python for
everything else.

You really will have to convince people here that execution speed is a
real issue for your programming task (in order to continue this
discussion). Otherwise the debate will go south real quick.

Keep well
Caleb
 
H

Harlin

If you give it a good go, you will be amazed at how the text processing
is so much better than Perl's. The same with the object orientation
(what oop in Perl?? none... at least none worth mentioning :) It's
been said before by many Python users... Python allows newbies to
program and wizards to be even more wizardly... or something to that
effect.
 
C

Caleb Hattingh

Hi Adam

Thanks for your comments.
I think the expression you seek is "comparing virtue among whores."

Sure, that's what I was saying, but not quite in as colourfil a manner
:)
Why don't you use C for the numerical work? Then you can do your number
crunching within a c-based python module. Have your cake and ...

As you might imagine, I think about this constantly. However, there
are many other issues that make it complicated, such as having to work
in a team where the average guy knows pascal well (we're just a bunch
of chemical engineers), but has never even heard of python. Plus, were
I to go this type of route, I would almost definitely code the binary
modules in Delphi or FreePascal, make a DLL and use ctypes to call it.
I do not know C and have no desire to learn now :) On the other
hand, I know pascal quite well.

keep well
Caleb
 
C

chris

I've read some posts on Perl versus Python and studied a bit of my
Python book.

I'm a software engineer, familiar with C++ objected oriented
development, but have been using Perl because it is great for pattern
matching, text processing, and automated testing. Our company is really
fixated on risk managnemt and the only way I can do enough testing
without working overtime (which some people have ended up doing) is by
automating my testing. That's what got me started on Perl.

I've read that many people prefer Python and that it is better than
Perl. However, I want to ask a few other questions.

This doesn't directly address your questions, but may be useful for
you, being a C++ programmer.

http://www.strombergers.com/python/

It is biased towards Python, obviously, but shows some practical
differences between Python and Perl that may be of interest.

-Chris
 
J

Joe Francia

Caleb said:
As you might imagine, I think about this constantly. However, there
are many other issues that make it complicated, such as having to work
in a team where the average guy knows pascal well (we're just a bunch
of chemical engineers), but has never even heard of python. Plus, were
I to go this type of route, I would almost definitely code the binary
modules in Delphi or FreePascal, make a DLL and use ctypes to call it.
I do not know C and have no desire to learn now :) On the other
hand, I know pascal quite well.

keep well
Caleb

You could always code Python extensions directly in Delphi:

http://membres.lycos.fr/marat/delphi/python.htm
http://www.atug.com/andypatterns/PythonDelphiLatest.htm

Demo09 (look in demodll.dpr & module.pas) in the download tells you how.

Peace,
Joe
 
C

Caleb Hattingh

Joe, thanks

Yes, I am on the P4D mailing list :) What you didn't say was that the
"python for delphi" extensions are *awesome*. full two-way communication,
and you get it all by drag&dropping a little component widget onto your
form in the IDE. Amazing.

However...

Dll's can be used by things other than python, which is the main reason
why we would go that route. However, with all the .NET hoopla, maybe
IronPython and a .NET dll would be the way to go in the future. I'm still
a little uneasy about adopting .NET as a standard just yet...

I should give it some more thought anyways.

Thanks again
Caleb
 
M

Mauro Cicognini

Alex said:
URK -- _my_ feeling is that we have entirely *too many* options for
stuff like web application frameworks, GUI toolkits, XML processing, ....


Alex

I entirely second that.

More, I'd heartily welcome an authoritative word on which to focus on
for each category... I hate to see scarce resources wasted.

Mauro
 
R

rzed

I entirely second that.

More, I'd heartily welcome an authoritative word on which to
focus on for each category... I hate to see scarce resources
wasted.

Alex also suggested that a revival of the anygui interface would be
a Good Thing. I would certainly love to see that.

It seems to me that Python should in fact include either anygui or
an equivalent to it as part of its core. Then to interface with a
given GUI package, it would be necessary to create a wrapper that
maps the wrapper's API to that standard Pythonic API. More work for
the package maintainers, and not easy to do in some cases, but for
the Python community it would be a huge gain. The same argument
could be made for the anydbm interface.

In both cases, the interface should not hinder the ability of a
developer to access any part of the package API, which implies that
parameters must be flexible. Maybe this is a strong use case for
bunch/data/namespace arguments and return values.
 

Ask a Question

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

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

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top