Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Perl vs. Python: A Culture Comparison

CmdrTaco posted more than 14 years ago | from the stuff-to-think-about dept.

Programming 351

davemabe writes "Every programmer has a favorite scripting language. Here is a well written article by Jon Udell from detailing the differences between Perl and Python, their cultures, OOP, database access, philosophies, and which one will gain the most converts in the future. Very interesting reading on an almost religious debate. "

Sorry! There are no comments related to the filter you selected.

Python parses indentation! (1)

possible (123857) | more than 14 years ago | (#1267708)

One annoying thing about Python is that indentation is parsed for statement-grouping purposes. Just like makefiles. It's a bad idea for languages meant to be written by humans.

How does Python deal with all types of whitespace? (2)

cpeterso (19082) | more than 14 years ago | (#1267709)

If Python uses whitespace to separate code blocks, does it treat tabs and spaces the same? Must you indent exactly N spaces? What if I tab-indent one line and then space-indent the next?

Asbestos Underwear Anyone? (1)

EricWright (16803) | more than 14 years ago | (#1267710)

Great job, guys! Way to start yet another flamewar. I can just see it now...

Perl Monger: Python bites!
Python Hacker: BS! Perl sucks!

Repeat ad nauseum ...


No, Perl! No, Python! Idiot! (2)

jjohn (2991) | more than 14 years ago | (#1267711)

How long will it take for this thread to dissolve into mindless zealotry? I suggest 10 posts max.

In the article, the author notes that: "As much as I admire Perl, I would never recommend it to a beginner". I'm just not certain this is valid.
Yes, Perl is a very complex language, but its high level abstractions allow the student to focus on the way algorithms work without getting too boggled by implementation. Python also allows for these while providing a "cleaner" OO interface.

Please, lets use these two great OSS tools in peace and harmony. There is rivalry here simply because the languages are more similar than not.

Re:Cool! (1)

wass (72082) | more than 14 years ago | (#1267712)

Check out Circuit Cellar Ink [] , and Embedded Systems Programming [] . Both of these are pretty decent techie print rags. Good stuff, by and for hackers.

In the end it was Zope (1)

Bwanazulia (126541) | more than 14 years ago | (#1267713)

The areticle does talk a lot about Perl and Python but in the end ends up talking about the Python Killer App, Zope If nothing else everyone should give Zope a once over. It as some really powerful features that should be making waves and M$ ASP, IIS and Vignette sites. BZ

JPython? (1)

mnf999 (137795) | more than 14 years ago | (#1267714)

I am more versed in Java than anything else... so bear with me. Why does he classify Python under the scripting languages?

I *am* looking for a script language but was evaluating Perl, JScript for a prototype. Is Python really a scripting language? do these features transpire in JPython?
any info appreciated.


Anonymous Coward | more than 14 years ago | (#1267715)

UnrealScript RULEZ!

Re:How does Python deal with all types of whitespa (1)

seoman70 (69627) | more than 14 years ago | (#1267716)

I've worked with Python a little before and this is one of the first things that bit me. AFAIK, it parses tab-indents and space-indents differently and thus Python won't parse code with mixed tabs and spaces as indents.

awww yeah (0)

Nastard (124180) | more than 14 years ago | (#1267717)

nothing will ever replace QBasic in my heart. Its not the size of your compiler, its what you do with it. i used mine to reverse engineer windows.

macgeyver could have saved the world from certain destruction at the hands of an evil terrorist with it.

Order vs Disorder (2)

grrussel (260) | more than 14 years ago | (#1267718)

I think the difference between python and perl can
simply be explained that perl is about getting
something done, no matter about how messy or
incorrect the method used may be, while python is
about doing things correctly 1st time, for later
use. Its the difference between grafting OOP into
a text processing language or including it from
the start.

Theres more than one way to do it, but theres
usually one correct and proper way. Python tends
to the second part of that, imho. Its also got a
more readable and less misused syntax, albeit
its use of whitespace is at the other extreme from
perl's fit it all into one line with no carraige
returns in sight. (if its not like that, your
likely not using perl to its tersest extent.)

From someone who has dabbled in both and used
neither significantly.

George Russell

Vs. (0)

Anonymous Coward | more than 14 years ago | (#1267719)

in another amazing cultural comparison, it has been shown that perl users are three times more likely to pour bowls of hot grits down their pants than python users. thank you.

cootchie-coo (1)

vyesue (76216) | more than 14 years ago | (#1267720)

Tcl/Tk is so wonderful, I don't see why anyone would bother using another scripting-type interpreted language.

Perl and Python Databases (1)

akgoel (153089) | more than 14 years ago | (#1267721)

Gotta quick question -

I use Microsoft's DAO to move my data from program to program. Would Python or Perl allow me quick access to this data, sorta like VB, but better?

Python rocks (0)

Anonymous Coward | more than 14 years ago | (#1267722)

At least Python has a better namesake.

His signature is wrong (0)

Anonymous Coward | more than 14 years ago | (#1267723)

Ok, if Microsoft was going to start making something that didn't suck, then why would they make vacuum cleaners? Vacuum cleaners DO suck. I think your sig is incorrect. Please refrain from ever using it again. Thank you.

Bzzzt...The Winner is Java (0)

Anonymous Coward | more than 14 years ago | (#1267724)

While the thought of java for desktop applications is enough to make by intestines clench, server-side java is quite nice.

You get to throw away the heavy, over-wrought, and redundant AWT/Swing classes and stick to the core classes. Most are very well architected and if sun were to fix the numeric and collection classes, as well as define a standard subset of the Java platform for server apps, the battle would be over today.

Sun isn't that smart a company and it will be a few years before someone like IBM wakes up and defines a new standard without sun's intervention.

tickle yourself :) (0)

Anonymous Coward | more than 14 years ago | (#1267725)

TCl/TK 8.0 is fantastic. Why doesn't it get the respect it so rightfully deserves. I can integrate all kinds of functional code with quick gui widgets that stand up. All scripters need to buy a TCl/TK book and code for a month. You'll see. Oh, it runs MUCH better on Unix, particularly Linux, where it is part of the distribution. Winbloze! Hey, when is somebody going to burn a huge M$ flag on TV. I'm still waiting for that to happen. Maybe I should do it myself 8}

Re:No, Perl! No, Python! Idiot! (2)

Petethelate (96300) | more than 14 years ago | (#1267726)

the author notes that: "As much as I admire Perl, I would never recommend it to a beginner". I'm just not certain this is valid.

I've recently had to go through a bunch of old scripts written by people who were (at the time) pretty new to Perl. The simpler scripts were fine, but the more complicated they got, the more some real discipline would have helped the code.

I'm not advocating a B&D language like Pascal, but if it's a script that is important to our business operations, I turn on warnings and use strict. It's amazing how many local-looking variables were used as globals. Still, I'm happy to have Perl as my nth language. Hmm, good subject for a Slashpoll, "how many languages have you developed programs in?"


agreed (0)

Anonymous Coward | more than 14 years ago | (#1267727)

if there was a poll, python or perl, i would vote perl, but if the poll was python,perl, or tcl/tk, tcl forever!

Re:Asbestos Underwear Anyone? (2)

technos (73414) | more than 14 years ago | (#1267728)

Thank God there are so many Perl programmers here! When the Great Flamewar erupts, we'll roll right over those OO, Python-using Zope dealers!

Don your asbestos!
You, you, and you. Break out the weapons!
You, you and you. Into the rigging!
And you! Put the kettle on..

Re:Python parses indentation! (1)

Anonymous Coward | more than 14 years ago | (#1267729)

Yet, ironically enough, perfect for languages meant to be written by snakes. What a wacky coincidence!

Re:Python parses indentation! (1)

benploni (125649) | more than 14 years ago | (#1267730)

But it's a good idea for languages meant to be READ by humans!

Re:When Will You Upgrade To Windows 2000? (0)

screeching weasel (18046) | more than 14 years ago | (#1267731)


Re:Python parses indentation! (1)

Dj (224) | more than 14 years ago | (#1267732)

No, it's not a bad thing, and if you read the article linked to you'll see why.

Re:How does Python deal with all types of whitespa (2)

benploni (125649) | more than 14 years ago | (#1267733)

Python does treat them differently. A tab is arbitrarily set equal to 8 spaces. However, it is hard to screw this up since compilation to bytecode will fail if it is inconsistent. Also, there are tools like tabnanny to watch out for things like this.

Re:His signature is wrong (1)

fuddmain (150288) | more than 14 years ago | (#1267734)

I think the point is if Microsoft made vacuums they wouldn't suck because they wouldn't work.

python ==great to know (2)

kb9vcr (127764) | more than 14 years ago | (#1267735)

I picked a book on programming python last year almost on a whim and I'm sure glad I did. As a person familar with c programming at the time with no where near a mastery of it I found learning pythong extremely easy and very enjoyable. The thing that I like most about python is the ease at which you can protype a program (quickly) and then convert your python modules over to c if you feel the need for more proformance. After just a skim of the tutorials just about anyone can be pumping out scripts in no time. Python is a combo of ABC, modula-3 and C. The ABC aspect can be seen in the way in which you need to format the program leading to a clean looking/readable code (every time). I recommend the language highly to anyone (not just the technically inclined)

Re:JPython? (2)

jovlinger (55075) | more than 14 years ago | (#1267736)

There is obviously a continuum (I cannot spell that word, your honor) between systems languages (such as java) and scripting languages (such as bash).

Typically, a scripting language has automatic variable declaration, doesn't need to be compiled before running, does little type checking, has high-powered built in types (assoc arrays, f.ex) and is easy to connect to prebuilt components (such as system libraries written in C or small helper programs such as grep). Python and perl both qualify.

Python (and these days perl) also have system language features such as OO and modules. In my very predjudiced taste, python's ortogonality ("there isn't more than one way to do it" -- none of this "current line" or "default argument" or "side-effecting comparisons" stuff that perl has) makes it more of a systems language than perl. In perl's defence, these very featuers make it very convenient for a wide array of tasks -- tasks that I don't do much, and hence my preference for Python.

This is a subject that has started more flame wars than any other language feature except maybe LISP's parens.

JPython is almost exactly like CPython, appart form the lack of certain default modules. Oh, and JPython can interface trivially with java -- this is a BIG win for me. I use it alot.

Re:Perl RULES! (0)

SethJ (139164) | more than 14 years ago | (#1267737)

$world_opinion = ~s/(python )rules/$1sucks/ig;
$world_opinion = ~s/(perl )sucks/$1rules/ig;

Oh, thanks, Slashdot. (1)

FFFish (7567) | more than 14 years ago | (#1267738)

What is this news posting going to accomplish, other than encouraging flamefests?

I'm not familiar with the Perl newsgroup, but I read the Python one regularly. It has been a friendly, open and sharing community... but over the past few months has experienced trolls that seem intent on disrupting the newsgroup.

Python is good. Perl is good. Different strokes for different folks. Python is based on some hard research into reducing errors and increasing maintainability; Perl seems to be based on accomplishing as much as possible using as few keystrokes as possible.

Both have their application. Both have their strengths and weaknesses.

And neither is going to benefit from the childish flamefests that seem to be popping up with increasing frequency. It would be better if Slashdot were to NOT contribute to this problem.


Re:How does Python deal with all types of whitespa (2)

Anonymous Shepherd (17338) | more than 14 years ago | (#1267739)

Um, actually, why are you using tabs alternated with spaces in the first place?

But no, I don't think tabs are treated the same as spaces(unless your editor automagically converts tabs to spaces...)


Indentation (2)

jerky (22019) | more than 14 years ago | (#1267740)

I'd just like to throw in my two cents about Python's indentation. I know that this has been endlessly discussed and flamed, but I just can't help myself. Let me start by saying that I like Python and I think the language is well-designed. I really like writing quick GUI apps with pygtk and having lists, dictionaries, WWW libraries and the like available.

With that said, I don't think I would ever write a large project in Python because of the extreme syntactic significance of whitespace. Python boosters always say that it avoids "indentation bugs" (as you can get in Perl, where the indentation of a block doesn't match the actual block boundaries). They also claim that with a good editor it's a non-issue. I don't buy these arguments.

For one thing, if you want to move code from one place in your program, you run into trouble. I use emacs, and with perl-mode (or cc-mode) I can just cut, paste, and then do an indent-region. With python, I have to figure out how much the code needs to be indented in its new place and make sure I line it up correctly for things to work.

Second, my more minor quibble is that it's substantially more painful to split long lines in Python. If you have a long subroutine call in perl with lots of parameters and a long subroutine name, you can split it across multiple lines however you like without thinking about it. In Python, you have to take care about how you put newlines into long lines.

I really believe that the significance of whitespace in Python cuts down on my productivity when coding Python. If someone came up with a Python preprocessor that let me use {}'s and made whitespace not count, I'd be the first to sign up.

Perl Can Get Messy (0)

Anonymous Coward | more than 14 years ago | (#1267741)

Last night, I was trying to suffocate my girlfriend with a perl necklace. All it really did was get sticky and make a big mess.

But when I wrapped a Python around her neck, she turned blue much more quickly and efficiently.

Thanks to the the object oriented programming techniques of Python, my girlfriend is nice and blue today.

Thanks Python!

It has quite some advantages (2)

Krollekop (86346) | more than 14 years ago | (#1267742)

Indentation for statement-grouping has quite some defenders, and does sometimes make sense.
For example, you usually use both curly brackets and indentation in your C/C++/Java/etc code to group statements. Brackets are intended for the compiler, while indentation are for the humans. Python simply uses indentation for both, and spares you those extra key strokes (no more Alt-9 and Alt-0 finger stretching on those non-qwerty keyboards!).
Secondly, this technique sets once and for all the layout coding practice. No more fight about where you should open the righ curly bracket.
In the end all this makes Python code easier to read, something you will appreciate the first time you must hack someone else's code.

Re:His signature is wrong (0)

Anonymous Coward | more than 14 years ago | (#1267743)

Its a joke. Which you failed to get. Please refrain from ever using the Itnernet again. Thank you.

Closures? (1)

hooha (147790) | more than 14 years ago | (#1267744)

Does Python implement closures properly yet? If not, I'll stick to my favourite language Objective CAML: []

Re:How does Python deal with all types of whitespa (1)

glyph (7208) | more than 14 years ago | (#1267745)

Basically, it's a bad idea to mix tab and space indentation. I prefer 1 tab == 1 indent, but the official dogma on the matter is that one tab is equivalent to eight spaces. (Hence, if your editor displays a tab as 4 spaces, as mine does, it's REALLY bad to mix tabs and spaces.) Regardless of this limitation, python is my favorite language, and I've only discovred it recently.

Re:JPython? (1)

benploni (125649) | more than 14 years ago | (#1267746)

Python is *sort* of a scripting language. The guy wrote wrote TCL tried once in a paper to define what is a scripting language, but it's still rather fuzzy.

Python can be used in place of shell scripting. It can also be used to write full blown GUI-based products. It has the scripting like attribute of not requiring compilation, but that's counterbalanced by the fact that it *does* compile scripts into bytecode.

Also, Python is a flexible beast. For example there are currentyl two completely seperate implementations ofg the Python language. One is written in C, and one is written in Java. the Java one compile Python code into Java bytecodes for execution in a Java VM. that's right, you can right applets that run in a browser in Python. You can use Java classes in JPython and even subclass them.

BYTE is still around?!? (1)

soybean (1120) | more than 14 years ago | (#1267747)

Wow, I had no idea.

and Another Thing... (2)

Kailden (129168) | more than 14 years ago | (#1267748)

Perl is something most females wouldn't mind having....try that with a Python....

Seriously, PERL wasn't meant to have a killer app...just meant to fill all those gaps in the supposedly killer apps you already bought.

Why I chose Python (1)

tjgrant (108530) | more than 14 years ago | (#1267749)

I was a longtime fan of REXX (One of the great benefits that OS/2 provided). When I finally abandoned OS/2 in favour of Windows I needed a new scripting tools and went in search. I couldn't find a free version of REXX for Win, so I looked elsewhere, I had heard about this Perl thing, so spent some time investigating it. It certainly seemed powerful, flexible, and useful.

One day while reading Dr. Dobbs they did a small sidebar on Python and I went and investigated it. It too seemed powerful, flexible and useful, but the thing that really attracted me to it was its readability.

I find well written Perl code to be very readable, but poorly written Perl code is almost unreadable. Python code is almost always readable to me, and even when I don't do the documenting job that I should, I can usually figure out what is going on in code I wrote two years ago. I can't do that with Perl code.

Stand Fast,

Re:Bzzzt...The Winner is Java (1)

bssea (79248) | more than 14 years ago | (#1267750)

I think Java is still too slow. Perl and Python are BOTH faster than Java, AND you don't have to compile Perl to run it( just run it through the interpeter )

Java has a wat to go

Re:How does Python deal with all types of whitespa (1)

Drinky Crow (27112) | more than 14 years ago | (#1267751)

According to the thread on this topic on c.l.python, python treats all tabs as 8 spaces. Use the '-tt' command line option to give a warning that tabs & spaces are used inconsistently.

And yes, mixing tabs and spaces is evil.

Championship bout (3)

348 (124012) | more than 14 years ago | (#1267752)

Larry Wall drops Guido van Rossum on the barricade. To the commentary table - big knife-edge chop by Wall. Guido is rolled back in - and manages a hot shot on Wall as he stands on the apron. Wall brought into the ring - elbow to the back of the skull. Pinpointing his blows, there's a punch and a kick in the same spot. Scoops him up - and drops him on the top rope. Right hand, right, off the ropes, but to the abs, neckbreaker - Guido covers, but only gets 2 as the "A Guido sucks" starts up in earnest. "Shut your mouth!"

Right, off the ropes, reversed, back elbow, elbowdrop, off the ropes with a kneedrop to the chin - 2 count. In the corner, right, right, into the opposite corner, follow lariat. Fisherman suplex coming up - 1, 2, shoulder up! That move NEVER works! Wall scoops him up for a bodyslam again - and now Wall is ready to try the Money Shot - Guido manages to bounce off the top rope, crotching Wall. REVERSE FIREMAN'S CARRY! Cover, referee "Blind" Jim Korderas in position - 1, 2, 3!!! Ladies and gentlemen, we have a NEW Champion!!!!!

Do we have a new champion in the scripting language areana? Does it matter if they're both well made products?

Re:Python parses indentation! (1)

FFFish (7567) | more than 14 years ago | (#1267753)

Against my better judgement, I'm going to respond to this troll:

Python uses whitespace as a delimiter because the language's creator did an actual useability study and discovered that whitespace is A Good Thing.

It's a language feature that will not change.

If you can't live with it, don't use Python. Trolling or arguing about it is pointless, childish and tiresome.


Re:Perl and Python Databases (1)

tincho (11804) | more than 14 years ago | (#1267754)

Both Perl and Python support instantiating COM objects under win32 platforms. DAO and ADO are implemeted as COM interfaces so you should be able to use them from these languages. I'm not very familiar with DAO, but I understand that moving to ADO (MS preferred solution at the moment) is fairly trivial. ADO interfaces were all designed with scripting in mind so they always use types and interfaces that can be used from scritping languages (i.e. late binding using the IDispatch interface).

Natural Languages and P--- Languages (5)

Lulu of the Lotus-Ea (3441) | more than 14 years ago | (#1267755)

Re: Jon Udell's: "A Perl Hacker in the Land of Python" (

Well, since someone else mentined it, here's a reaction I had to an
email conversation where the Udell URL was cited. Take it or leave
it... but I finally pinned down what I think is wrong with Wall's
initially rather intriguing 'philosophy':

You know in Perl the motto is "there is more than one way to do it".
Larry Wall takes this by way of a linguistics background, and wants
to make Perl resemble a natural language. In contrast--at least at a
syntactic level--Python has fairly clear rules about what something
*has* to look like, and there tends to be a high degree of
orthogonality (which Wall vehemently eschews). There were some
remarks like this in the article. (Obviously, in terms of semantics,
large-scale design, and algorithms, there are many ways to do a thing
in any language).

I think Perl succeeds in what it is trying to do. For that reason,
it really does often look like a "write-only" language. You can
easily express your own "thoughts" fluidly and naturally... the
problem is that they are then as difficult to unpack later as a poem
or a complex philosophical sentence (good uses of natural language).

The thing that Wall &gang seem to miss is the distinct registers of
natural language. The whole thing is very rich in expressivity, and
highly non-orthogonal. But that is absolutely *NOT* the case when it
comes to specialized areas of natural language where clarity and
precision are at a premium. I *WANT* air-traffic controllers to
speak in a highly structured, syntactically and lexically limited,
and stereotypical fashion! I really *DO NOT* want them to use free
verse! To a somewhat lesser extent, I also want programming specs or
technical documentation to follow a rather rigid pattern. When I
look in the help file, it makes my life a lot easier if the list of
parameters to a function are always described under the same heading,
with a consistent and fairly small subset of English words, and with
an attention to consistent whitespace, layout and special characters.

The moral is that Perl is a great language for *implementing*
haiku... but Python is rather better at implementing functional

Yours, Lulu...

Horay! We finally got coverage. Python rocks! (2)

Anonymous Coward | more than 14 years ago | (#1267756)

I feel like a freebsd user who finally read an article that talked about freebsd rather then linux. :-)

As you can tell I am a huge fan of python. I am currently learning perl but it can be real cryptic sometimes. This is especially true if you use perl at work and you are trying to read someone elses code. Yeuck!

I have always prefered basic over c (yes basic is as powerfull as c. Just because you used it to first learn programming for basic stuff like "hello World" doesn't mean thats all it can do. My father wrote a optical recogntion program that reads bar codes written tottaly in basic), c over lisp by far, and python over perl because I prefer something thats powerfull but is clean, logically and concise.

When I I first wrote programs with perl, I learned how to write things in a certian way but some of the other guys at work prefer to write parts of the same program in a totally different way and its nearly impossible to learn every possible way to code in every situation.

I love python because I can read a co-workers code and he or she can read mine. One of the things I like about linux is that the OS is more simplier and consistant then NT. Clean, simple and consistant is what I prefer in my computer environment. Something huge and powerfull doesn't bother me, as long as its not overly complex like Windows win32 api/MFC. I believe complexity is the reason the TCO of pc's keep going up and up. WIndows is full of bugs because of the programming environment.

I know a few perl users will love the idea of several different ways to solve problems and may even use linux as an example as "..There is more then one way to solve a problem with unix" which makes this idea neat in programming as well. I can see this view point as well.

I guess its like a scale. Over simplistic things liek vb script lacks power but something like MFC, Dlls and the whole win32 environment has too much complexity that leads to bugs.

This is just my take. Try python out. Its really cool and fun!

Of Zope, whitespace and style (4)

ajs (35943) | more than 14 years ago | (#1267757)

I'm a Perl guy (note the sig [] ), but this article really pushed me in my long-standing desire to learn more about Python.

Zope sounded interesting, but I'm also checking out Mason [] , a Perl-based system that is tied into mod_perl. mod_perl was perl's six or seventh killer application (and I mean application as in applying a tool to a job, not as in a packaged program). First came the power of Perl regex for text processing. Then CGI (remember CGI was pretty much born in Perl). Then came LWP, and a splash was heard round the world. How many robots and spiders are written in anything else?

Perl is slowing, though. There is a consolidation and honing of features that needs to take place, and perl resists that. In some ways, this makes me long for something like Python, but I've actually been thinking of writing a Perl variant that accomplishes some of the same goals, but aimed more at large-scale programming in performance-oriented environments. I see the main benefits of a new language design being:

  1. Can pick and choose the "best of" Perl.
  2. Some odd Perl tics (e.g. bareword IO handles) can be dropped.
  3. Byte and native compilation of modules and programs would be a primary goal. I won't be happy with Perl byte-compilation until everything in the library can be byte-compiled and used from non-byte-compiled programs. But, there are some very compelling reasons not to re-tool Perl's core to allow for this (it would break too much).

I dunno. I'll probably spend a couple of months scoping other languages before making any real investment of time.

As for whitespace and style issues, I dislike Python's way so much that I've put off learning the language for years. It's just so... FORTRAN. Why, of all things would you, in this day and age, subject people to a DEFINITION of TABS?! Why not enforce variable-naming at the same time?

No, Perl! No, Python! FOOL! (2)

Duxup (72775) | more than 14 years ago | (#1267758)

Actually it took a bit longer than 10 posts, looks like #12 was the first thought free post by an advocate for either side. It's a calm day here on /. today I guess.

I would have to agree that the rivalry actually comes from their similarities (like all good rivalries it would seem). It's weird how I would think that such OSS tools while being OSS in nature would promote diversity, and mostly I believe they really have. OSS has always seemed something that is intended to (among other things) bring us new options and choices where there really were none before. However without fail being similar causes some infighting between fans of either side that resembles a fight for dominance over the other (thus eliminating an option). I wonder if that says something about humanity and it's relationship with OSS.

Oh and I almost forgot PERL RULES!!!! DOWN WITH PYTHON!!!!

Actually I've never used either, but the debate has me very curious :-)

Re:Championship bout (1)

benploni (125649) | more than 14 years ago | (#1267759)

You forgot to mention how Guido indented Larry's skull! :-)

Re:No, Perl! No, Python! Idiot! (0)

Anonymous Coward | more than 14 years ago | (#1267760)

Why not encourage rabid competition between the two of them? that is the fastest way to make things better


Jack William Bell (84469) | more than 14 years ago | (#1267761)

One major point the article makes is the philosophical differences between the languages. This is best illustrated by the simple "There's More Than One Way To Do It" (TIMTOWTDI) approach of PERL versus the "Keep It Simple Stupid" (KISS)design of Python. I think this is not only valid, but possibly the most fundamental difference between the languages. Outweighing even the Object Oriented aspects.

As a programmer I am very attracted to Python's clean syntax and deceptively simple low level data structures. Within this simplicity lurks some very impressive thinking about how programming languages should be used. For example Tuples are first order objects in Python! The only other languages I know of with Tuples as first order data structures are declarative languages like SQL. (Someone is sure to tell me how I am wrong in a reply...)

What this simplicity means is that I can build arbitrarily complex structures from those simple elements and the next programmer to look at my code will be able to follow my code without too much effort. Building complex structures from simple ones is the very essense of Object Oriented design, look at Smalltalk for another example of this approach -- although Python has an arguably better syntax than Smalltalk.

On the other hand, providing multiple ways to accomplish the same action means that the programmer can choose the method best suited to the current need, both in parsimonious code and optimal execution time. In this PERL is rather like C++ which often provides 15 different ways of doing the same thing, each optimized for a different purpose. The downside of this is that you need to know every one of those 15 possible ways to get the job done and understand the reasons why any one is best suited for a particular need...

My, long winded, point is this: TIMTOWTDI can potentially provide shorter programs and better execution times, but will always result in more difficult to understand code. Moreover, many programs will not be optimally coded because the programmer who writes them will only understand 10 or 11 of the 15 ways to do things, resulting in the old "When you have a hammer, everything looks like a nail." problem. However the KISS approach ends up with more total lines of code and, perhaps, slower execution times, but the code will be more accessable and (therefore) more maintainable.

And this is why I prefer Python. Processing cycles are cheap, but programmers are expensive. I am always willing to trade one for the other. If I have to choose between a language that promotes code clarity and simplifies maintenance over another that tends to shroud the algolrithms in terse bits of bizarre sytax then I will always go with the former...


Sorry, DJ (1)

FFFish (7567) | more than 14 years ago | (#1267762)

My bad; I followed-up the wrong message; it was directed at "possible", not you!


Re:No, Perl! No, Python! Idiot! (1)

Mandi Walls (6721) | more than 14 years ago | (#1267763)

I don't usually recommend Perl to beginners. It's been my experience with most disciplines that a newbie is better off starting out with a more strict approach, and then running off into fancy jumps and kicks and whatever.

For example, it's hard to explain the importance of memory allocation in ints, chars, floats, etc, to a person who is used to Perl taking care of all that stuff, compared to bringing a C++ programmer over the the more relaxed environment of Perl.

For me anyway, I appreciate Perl's string processing and hashes more because of what a pain in the neck they can be in C++, which was my first language.

someday i'll look at python. when i have a minute...

Re:It has quite some advantages (2)

possible (123857) | more than 14 years ago | (#1267764)

Saving keystrokes is not of primary importance to most programmers. Two pieces of code which look exactly the same in most text editors and in hard-copy should be executed exactly the same, otherwise confusion can arise.

This has not made Python easier to read for me, certainly.

Overide tabulation with spaces in your IDE (1)

Krollekop (86346) | more than 14 years ago | (#1267765)

If you setup you editor so that it automatically replaces tabs with spaces, you're safe.
For example, Emacs' users could do one of the following:

(setq indent-tabs-mode nil) in .emacs,
M-x untabify in the mini-buffer.

I've just start learning Python (1)

Omnifarious (11933) | more than 14 years ago | (#1267766)

And I have to agree with the author's overall general assessment. It's kind of annoying that indentation matters, but since I've always been scrupulous about that in the past, it doesn't really affect me much. At least, not until I have a line longer than fits on the editor window. :-)

As for Python's consistency... I find that to be very nice. I find perl's utter lack thereof to be highly annoying. I don't care what Larry Wall says about the problem domain, computer languages are supposed to be very precise and clean because, ultimately, what they do is describe a very precise and detailed set of tiny instructions for doing something. Of course, I'm something of a hyprocrite because I use (and sort of like) C++ regularily, but hey... :-)

Also, Python was designed with introspection and reflection in mind. This makes the whole mechanism by which scopes and identifiers are actually handled much more transparent and easier to work with than perl's. I'm designing something that sets up execution environments (complete with special namespaces) for things to operate in. I don't know how I'd even think about going about this with perl. From hints I've gotten, I suspect it's possible, but I'm betting it's a huge pain.

Re:Indentation (0)

Anonymous Coward | more than 14 years ago | (#1267767)

Minor quibble: with python-mode in emacs, indent region works just fine.

Emacs works great on Python whitespace... (2)

Eric Green (627) | more than 14 years ago | (#1267768)

Using 'python' mode in Emacs, a 'tab' key takes you to the current default indentation level, while the 'backspace' key drops you back an indentation level (to, say, close an 'if' block). 'pass', 'continue', 'return', and 'raise' also decrement the current default indentation level, while block signifiers (e.g. "def", "class", "if", etc.) increment the current default indentation level.

All in all, the white space issue is one of the only things I dislike about Python, but not because it's a pain to keep track of white space (Emacs, and, I presume, 'vim' or [chuckle]vigor, do that for me). Rather, it is because it makes Python hard to embed in web pages the way you can do with PHP3 or 'eperl' or similar tools. The Python zealots say that this is a feature, that you should not mix program and display in the same file, you should instead use an approach similar to ZOPE's 'DTML' (which uses SHTML-like commands to embed the results of a Python object's execution into a web page). Personally, I believe they are too quick to deprecate the advantages of sometimes embedding short little server-side scripts into web pages.

Final comment: Despite my reference to "Python zealots", I personally avoid Perl like the plague. I will use PHP3 before I use Perl. Not because PHP3 is a great language (it isn't), but because Perl is a bloated, cryptic, messy language and proud of it. Perl is a language for dog people, i.e., people who like big, shaggy, messy critters that slobber all over the place, chew on everything, etc. and that require a lot of work to maintain. Python is a language for cat people, people who like neat, independent, self-contained critters that don't require a lot of maintenance. As you can tell from my .sig, I'm one of the latter :-).


Re:How does Python deal with all types of whitespa (2)

Evil Spammer (134781) | more than 14 years ago | (#1267769)

Um, actually, why are you using tabs alternated with spaces in the first place?

What about when you're editing someone else's code? Yes, automatic tab conversion is nice, but can confuse CVS since every line may be seen as changed (depending on your CVS tool.)

I've been writing a lot of Python the last couple of months and I find I cannot cope with the indentation issue without having emacs take care of it for me. It forces correct indentation and consistency with other programmers' code. Otherwise I would spend half my time twiddling the space bar!

Re:JPython? (2)

AMK (3114) | more than 14 years ago | (#1267770)

There's actually a third, experimental Python implementation: Vyper [] , written in OCaml by Max Skaller. Skaller's interested in compiling directly to OCaml, doing type inference, and experimenting with new scoping rules and keywords. Still quite alpha, and obviously there are incompatibilities with CPython and JPython (but then, that's the point).

I think it's neat that Python is small enough so that you stand a reasonable chance of implementing it on top of your system language of choice, be it C, Java, OCaml, Modula-3, or whatever.

How holy wars start.... (5)

WhiskeyJack (126722) | more than 14 years ago | (#1267771)

The two monks stand side by side, facing the altar, behind which a graven image of the Great and Benevolent Tux stands with wings half spread as he contemplates the GNU/Path to True Enlightenment Through Open Source. One monk wears a single pearl upon his forehead, glimmering in the flickering light of the altar candles. The other sports a torc in the form of a serpent entwined around his upper arm. The gaze upon the image of Tux placidly, each at inner peace.

The monk with the pearl breaks the silence: "Good brother, I see your movement grow by leaps and bounds. How is this so?"

The monk with the serpent replies: "It is our more disciplined coding, brother, which more quickly leads down the One True Path of Enlightenment. Discipline of code leads to discipline of mind and body."

Pearl: "But what of tailoring the Quest to the individual? Be flexible like water, and in time, even stone will fall before it."

Serpent: "Be structured like iron, and the stone will fall faster."

Pearl: "But each mind is different, and should be allowed to find their own path."

Serpent: "There is but one Path, brother, just many ways to find it. Ours is the quickest and most sure."

The candles on the altar continue to flicker as the two monks fall into a few moments silent contemplation.

Pearl: "I am afraid I must disagree."

Serpent: "So you say, but you know the truth in your heart. Did not your order adopt the doctrine of OOP despite the conflicts with your order's earlier, strictly procedural ways?"

Pearl: "OOP is just one path of many."

Serpent: "It is the soul of the Way."

Pearl: "And so you seek to challenge the longstanding authority of the Order of the Pearl? We have existed longer, and are closer to the Truth!"

Serpent: "You wander blind in the mists, poor deluded souls, while the True Way beckons! You can yet change your $PATH."

Pearl: "You speak heresy! Leave the Holy Temple before the Great and Benevolent Tux smites you!"

Serpent: "I speak Truth, and you are but too mad to see it! I curse you and your Order! The Way of the Serpent will triumph!"

And the monk with the serpent turns and stalks out of the Temple, growling, "We will be back, and in numbers! The Temple will be ours!"

The monk with the pearl watches his counterpart leave, turning back to the altar and shaking his head. "We will be waiting, and the Great and Benevolent Tux is on our side!"

-- WhiskeyJack, on serious caffeine withdrawal.

how to comment perl (1)

C. E. Sum (1065) | more than 14 years ago | (#1267772)

By way of introduction, I work with Perl daily. My 'ork-place uses it extensively as part of our product (yep, we ship a complete perl5 tree with every copy) and in the test group we use Perl as glue to write all sort of automated tests.

This summer I went out and bought a copy of Learning Perl and I begen my trek down the road of Perl enlightenment. Now, since then I've written .. probably a few thousand lines of Perl code. I bought the Perl Cookbook and Programming Perl. I read comp.lang.perl.moderated [lang.perl.moderated] , and generally and starting to really get into the Perl way of thinking. I enjoy thinking in Perl . . .

But now, I look at my scripts, and think "six months ago, I would never have been able to read this." I wouldn't have a clue how my code works. I have comments about the general flow and intent my programs, so that one could at least identify where things happen. But I've always ahered to the idea that one should not write comments like:

i++; /* increment i */
in C. But I feel the desire to write things like:
while (<>) {
# code that operates on STDIN or the command line arguments
in my Perl.

What's a concientious coder to do? Comment for the newbie and end up with over-commented code? Comment for someone who has read Programming Perl? Comment for the "Just another Perl hacker" crowd?

Zope for Perl (2)

chromatic (9471) | more than 14 years ago | (#1267773)

Funny, Udell and I had an e-mail conversation similar to this a couple of weeks ago. While I disagree with him on the appropriateness of Perl as a beginning language (after reading Elements of Programming With Perl [] ), I think he's right on the money about Zope being Python's killer app. Real programming ought to be more about getting stuff done than arguing over whitespace.

Now the Everything [] engine is very flexible, and Slash [] lets you get a lot done, there's really nothing out there like Zope [] for Perl.

At the risk of a shameless plug, let me just say that that's why i started Jellybean [] .


Neither... :-) (1)

Alrescha (50745) | more than 14 years ago | (#1267774)

I think Rexx is pretty nice. Written by humans for humans, nicely readable 6 months after you wrote it, nice string handling, etc. etc.

Oh, it's free for Linux (from IBM even). It can be found here:

Re:Order vs Disorder (3)

Stigma (35884) | more than 14 years ago | (#1267775)

> I think the difference between python and perl
> can simply be explained that perl is about
> getting something done, no matter about how
> messy or incorrect the method used may be,
> while python is about doing things correctly
> 1st time, for later use.

What? Because Python forces you to a strict coding style doesn't mean that your code is "correct". It's still possible to write a bad algorithm in Python, just as it is in Perl.

> Its the difference between grafting OOP into a
> text processing language or including it from
> the start.

Perhaps you should actually point out some limitations of Perl's OOP. Maybe you could also explain what this has to do with your own code quality.

> Its also got a more readable and less misused
> syntax, albeit its use of whitespace is at the
> other extreme from perl's fit it all into one
> line with no carraige returns in sight. (if its
> not like that, your likely not using perl to its
> tersest extent.)

What are you talking about? Sure it's possible to write Perl code on one line, just as in many other languages. Unless you're an idiot, or purposefully writing obfuscated code, it's generally not done.

I'm sick of all these comments complaining about how hard Perl code is to read.

Providing that:
a) you actually know the language, and
b) the code was written by someone who actually knows the language

You should have zero problems with readability. Remarkably enough, the above applies for nearly every other programming language.

> From someone who has dabbled in both and used
> neither significantly.

Like so many others in this discussion, I doubt that you're qualified to make such broad assumptions about either language.

Library interface between Perl and Python (3)

Ed Avis (5917) | more than 14 years ago | (#1267776)

I use Perl a lot; while I've read the book Learning Python, I haven't really used the language, so please correct me if I'm wrong:

It seems that the essential structure of Perl and Python is pretty similar most of the time. Okay, Python doesn't have function closures and other funky features, but most programs and libraries don't use them. Similarly, the two OO paradigms are a little different, but the basics - creating an object, simple inheritance - are the same, and this is often all you use anyway. Applying the 80/20 rule, you could say that they are pretty similar.

What would be cool is a way to call Perl libraries from Python, and vice versa. For example, Perl's DBI is said to be better than Python's database drivers (which tend to be specific to a particular DBMS). Since most DBI methods are just creating an object, performing an action, or returning a list as a result, it would be easy to write Python wrappers for them. Similarly, some cool things like wxWindows have Python bindings and no Perl bindings, but the features they use aren't particularly Python-specific. (wxWindows is written in C++.)

So how about a general interface for Python that wraps any Perl module? Then Python programmers could take advantage of the world's largest archive of reusable software, CPAN. It would be a fairly simple matter (I suppose) to load in, tell it to load the Perl module, and then whenever a call is made to the module, marshal the arguments from Python dictionaries to Perl hashes, Python strings to Perl strings and so on. Of course many modules which depend on Perl intricacies wouldn't work here, but most modules would.

The opposite interface would be fairly similar. Since Perl's lists and hashes do not nest, you'd need to convert a Python function or method returning a list to a Perl one returning a list reference. But apart from that things should be just the same.

I'm a keen Perl programmer, and the one thing that's stopping me from trying Python out for real work is that I'd have to wave goodbye to all those lovely CPAN libraries. So could someone with more knowledge say whether a scheme like the above is possible?

Re:Bzzzt...The Winner is Java (1)

mwa (26272) | more than 14 years ago | (#1267777)

server-side java is quite nice

NOT. At least in my environment, where there are multiple Java-based servers (not servelets!), I can't buy memory fast enough to keep them all running. Not that I can blame it completely on the language...Could also be multiple vendors, each of which includes their own version of a JVM. (I wish some vendors would get a clue and just say "This application requires [JVM|perl|web-server|whatever]. Go get the one you want", instead of installing their own versions all over the place.) Whoops, slipped into rant mode.

Besides that, if I had to have some Java feature I'd still use jpython. You code and test like a scripting language and, when everything works, compile into native Java classes. Much faster for occasional Java use..

Re:how to comment perl (2)

PigleT (28894) | more than 14 years ago | (#1267778)

Um. But the reason you write comments is not because you couldn't have read it 6 months ago, but because you think you won't be able to in 6 months' time, or because some other chap won't be able to, surely?

Anyway. I don't believe in comments particularly. I'm firmly of the "if you can't read it and it's valid perl, that's your sad loss" mentality. Not that this allows me to go out of my way to obfuscate code, but if it's something the way I'd expect to read it, then I expect you to read it the same too.
Amongst other things, if you're paying me to write perl, you're not paying me to write English. If you can't read it, that's your bad lookout. There's nothing worse than excessive real-language usage for confusion or wasteage. (C.f. SQL, COBOL, ... all designed by management, more or less!)

Zope is Pythons Killer App??? (1)

emfb (96321) | more than 14 years ago | (#1267779)

Anyone who knows anything about Python knows PySol is the true killer app!

A little fairy whispered in my ear (0)

Anonymous Coward | more than 14 years ago | (#1267780)

She said "PyTHoN iZ FoR HoBBiT MoFoZZZZ!!!!"

Yup. She had some big tits too!

Re:How does Python deal with all types of whitespa (1)

dugb (10154) | more than 14 years ago | (#1267781)

in my experience this sort of thing crops up a lot in group development projects, an area where python would do well. I'm all right with language-imposed formatting restrictions since it saves developers' time of understanding and reformatting each others' code.

OOP? Some stupidities will never die... (0)

jeeves_jv (140418) | more than 14 years ago | (#1267782)

One of the reasons I use Perl quite a bit, for all kinds of stuff, is because OO is a "bolt-on" rather than I "built-in". I still can't believe the extent to which a bogus concept like "Object-Oriented Programming" has been accepted by the mainstream commercial development people (i.e. People Who Write Windows Software). The vast majority of the programs I see developed for Linux these days seem to be written in C. Or at least, quite a few of them. = )

Anyone ever read that joke interview with Stroustrup regarding the invention of C++, and how it was actually just a ploy to raise the salaries of programmers? I doubt that's what the inventors intended, but the fact that most of the denouncements of the "features" of the language in that interview are perfectly supportable is very interesting... (not only that, but C++ is single-handedly responsible for the entire Windows community ;).

Ok, so I'm joking a little bit, but mostly not. I still think OOP isn't very useful. And as far as the Perl vs. Python article goes, use whatever gets the job done better, but non-enforced OOP is IMO definitely a good thing.


Re:Indentation (1)

glyph (7208) | more than 14 years ago | (#1267783)

First of all, let me say that I think we can have a discussion about languages on slashdot WITHOUT flaming each others' brains out. I will do my best to respond to these comments in the civil tone in which they were first stated.

Now, on to the indentation: I am switching my "large project" from Java to CPython, explicitly because it *does* have such strict indentation rules. If your project is large and has to be maintained by many people, it's VERY important that the indentation be consistent.

One thing that I will agree is an annoyance in python is copying and pasting -- but one thing you're missing if you believe this is an important feature for a language is you should never ever copy and paste code! If you're repeating yourself, you should have to stop and think, "Do I really need to do this?" I have hit that a few times, and after middle-clicking, while I was correcting my indentation, I realized that I should really be using a subroutine or some sort of object abstraction for whatever it was I was copying.

This is also why I believe Python is better suited towards being a systems language, despite it's creators protestations about it being a scripting language -- when I have simple scripting to do, perl would win out. Although I'll dump on Perl in a strictly perl-versus-python debate, it is completely indespensable to me as a 'better sed'. For one-shot, throwaway programs, it is almost always better than python.

Finally, about splitting long lines where you have a long list of arguements: again, you really shouldn't have arguement lists that long. This isn't really a hard-and-fast programming rule though, so if you *do* run into that, the rule in python is simple. Break lines on the commas. Indent them in the same way you would in C. Xemacs does this for me automatically. This never really occurred to me as a problem, and I do it all the time.

Re:Python parses indentation! (1)

possible (123857) | more than 14 years ago | (#1267784)

I'm trolling? You've told me I'm acting in a pointless, childish, and tiresome manner, whereas I simply pointed out something I've found annoys me and other experienced Python programmers.

I will continue to use Python where it's applicable and where relevant, I will continue to point out shortcomings in the language. If you disagree, you're more than welcome to argue with me, but if you're so worried about trolling, you should start with yourself.

Perl for now, Python later (maybe?) (2)

G27 Radio (78394) | more than 14 years ago | (#1267785)

I'm kinda in the same boat as the author. I've played around with Python a little, but I know a lot more about Perl.

Like the author, the forced indentation in Python isn't bothersome at all because I do it anyway with Perl. My brain would melt if I tried to read any of my code and it wasn't indented properly. Also I agree with the author about CPAN. It's unbelievably easy to grab a module, compile, and install it. If you have the cpan program installed on your computer it's often as easy as typing "install Module" -- it'll download it from one of the mirrors, compile it, and install it, often with no required user interaction. I love that.

There's something that bugs me about Python, but it's not exactly a good reason not to use it. The code just looks kinda bland to me. Almost like BASIC or something. Maybe I just have a thing for using braces or something. I dunno.

At any rate, I was still very impressed with Python. I might make the switch someday, but at this point it hasn't been able to drag me away from Perl. Python is supposed to be especially good for rapidly developing software. The software can be written in Python, then pieces can be easily replaced with faster C or C++ code later--from what I've been told at least.

One open source project that is using a lot of Python code for development is Worldforge [] . Worldforge is going to be a massively-multiplayer online game. Neat stuff.


Re:JPython? (0)

Anonymous Coward | more than 14 years ago | (#1267786)

Just some miscellaneous info...

You can make it so MS Internet Explorer uses Python as a scripting language in addition to JScript or VBScript. I'll let someone else talk about why Python is classified as a scripting language by that article. IMHO Python makes a good replacement for Java.

JPython is basically a Java program that can run Python programs. So with JPython, you are writing Python code but you can load and use Java libraries. I wrote a GUI with Java's Swing classes using JPython, I thought it was much easier to develop a prototype than if I just used Java. But it's running in the JVM so you have the same restrictions as a Java app.

Re:Closures? (2)

burris (122191) | more than 14 years ago | (#1267787)

There is an implementation of Python in ocaml, believe it or not. It has true garbage collection and possibly "proper" closures. There are also other features... ar.gz

What is wrong with closures in CPython?


Re:Indentation (1)

Anonymous Coward | more than 14 years ago | (#1267788)

I am currently working on a fairly substantial project, and we are doing everything in Python. We are using ASP, and were using Perlscript. After about 6 months of beating my coworkers over the head, we started moving things piecemeal to Python. Now, our productivity is way up, our code is far less buggy, and not a one of us can look at our old Perl code without getting queasy.

As far as the "cut-n-paste" problem, it is not Python's fault your using a bad programming practice. Take the duplicate code, throw it in a function, module or class, and reuse it. Remember, OO is not just a cool catch phrase, it actually helps you REUSE code. Checkout Refactoring by Martin Fowler and XP Explained by Kent Beck. If the indentation is hard to figure out, then you're doing it wrong (or at least not as well as you could be.

- From someone tired of being a software maid


Tony Tastey (247) | more than 14 years ago | (#1267789)

Since you asked for it, ML also treats tuples as first order data structures.

I must be an exception to the norm :) (2)

tuffy (10202) | more than 14 years ago | (#1267790)

Python's whitespace is something I never think about. As you say, Emacs all but eliminates any problem that might cause and Python is very forgiving about wrapping lines. I went from a strong Java background into Python and have come to enjoy the quick & dirty typeless nature while at the same time using inheritance to make powerful OO constructs.

But I can't stand cats. Give my a well-behaved, predictable, loyal and non-shedding dog any day :) (there really are such beasts...the house stays clean as can be) Now if you really want to start a flame war, forget this Perl/Python stuff and start a cat/dog debate :)

Re: Perl/Python faster than Java (Wrong) (3)

rcromwell2 (73488) | more than 14 years ago | (#1267791)

Sorry, but this is bullshit. JPython is written in Java and runs the same speed (and on some benchmarks faster) than CPython. How can JPython run Python as fast as CPython, yet Java be *slower* than Python? I don't think so.

Perl's PP-bytecode execution speed is about 100 times slower than a JIT'ed Java App, just try writing a straight numerical app like a Fast Fourier Transform, or a JPEG-decoder in *pure* perl, with no XS modules that escape to C.

If you look at, they have proof that Java servlets are faster than mod_perl.

Perhaps you are refering to the GUI widgets being slow, but the GUI widgets are just a module, like Tk/wxWindows and are just an add-on to the VM, not part of the language. Not only that, but there are numerous third-party replacements for the standard Swing/AWT widgets that run very fast.

The fact remains that Python/Perl are interpreted, and Java, while being bytecoded, is compiled on the fly to native instructions.

There are plenty of code libraries out there that demonstrate Java's relative speed vis-a-vis other interpreted languages.

Java's JMF multimedia framework demonstrates realtime MP3 decoding, and MPEG/AVI decoding in pure Java. demonstrates an *XSERVER*, yes, an X11 display server, ESound server, and true-type font server written in Java.

At you can see real-time "megademos" doing 3D transformations, lighting, texture, and bump mapping. With Java2, some of these run fullscreen (640x480) at 20fps.

Java Cryptography libraries demonstrate very fast encoding performance. Try writing a Pure Perl/Python RSA/DES/RC-4 library, and an SSL stack that can perform.

Yes, we know Java isn't as fast as optimized C. But Perl/Python can't beat Java unless you write a program that is almost entirely made up of calls to Perl's native facilities (perlfunc functions, regex, and hashtables). Anything that has to process a large amount of data, *and* isn't related to parsing/manipulating text, will run slow.

If you created a native-library hashtable for java, and native library string and regex libs, Java would exceed at text processing too.

Re:Cool! (1)

alangmead (109702) | more than 14 years ago | (#1267792)

Unfortunately, those magazines target only a small portion of what Byte covered. Circuit Cellar doesn't stray too far from the homebrew mentality of Ciarcia's old columns. Byte went beyond that low level articles and then do system comparisons, and then language tutorials, and then software reviews, and whatever else it could cover. Byte essentially covered everything from at the highest most abstract details and from the lowest details.

Byte was a magazine that everyone from the manager who never coded (or one whose technologies they mastered are obsolete) to the low level hacker. But it seems this range of audience is what caused its advertiser base to dry up as explained here. [hacker.http]

Re:It has quite some advantages (1)

churchr (24226) | more than 14 years ago | (#1267793)

> Two peices of code which look exactly the same
> in most text editorsand in hard-copy should
> be exectly the same.

In python, they are. You may be thinking of
Fortran or something like that. I was skeptical
of python's whitespace syntax at first, but
after using it a little bit, I think it's
ingenious. It actually enforces exactly the
kind of consistency you're talking about, far
better than pnuctuation-delited schemes.

Re:OOP? Some stupidities will never die... (1)

Junta (36770) | more than 14 years ago | (#1267794)

I dunno, I personally like coding in straight C, but OO approaches do have merits. Object Oriented approaches are often quicker to implement, especially on larger projects with teams of programmers.I've worked with both, use C when I can, but the times I've had to use C++, I've found it easier for development and maintenance *particularly* maintenance. Inheritance/Polymorphism does make it easier to extend functionality of existing libraries, and perhaps this is the biggest strength of C++ in commercial environments, making it easier to throw something together and get it to market, wheter it be an initial release or an upgrade.
In Open Software, deadlines are often not critical, so people chose C because it is a bit less overhead, and they feel no need to push it out to market and will do it the most efficient way they can.

Solution (2)

exoduz (100720) | more than 14 years ago | (#1267795)

If someone would make a python preprocessor that sets correct python indentations according to code blocks delimited with {}'s and ;'s, this would eleminate all the complaints from the "other" side without having to rewrite the parser.

THe formatted code going in would always look the same to the compiler but the coder can look at and write the program which ever way that suites their style. With braces or no braces.

Anyone interested in making something like this?
Or If there's something out there... plz point me in the right direction!!!

# exoduz : escape while you can.

Re:Natural Languages and P--- Languages (2)

rgmoore (133276) | more than 14 years ago | (#1267796)

The thing that Wall &gang seem to miss is the distinct registers of natural language. The whole thing is very rich in expressivity, and highly non-orthogonal. But that is absolutely *NOT* the case when it comes to specialized areas of natural language where clarity and precision are at a premium. I *WANT* air-traffic controllers to speak in a highly structured, syntactically and lexically limited, and stereotypical fashion! I really *DO NOT* want them to use free verse! To a somewhat lesser extent, I also want programming specs or technical documentation to follow a rather rigid pattern. When I look in the help file, it makes my life a lot easier if the list of parameters to a function are always described under the same heading, with a consistent and fairly small subset of English words, and with an attention to consistent whitespace, layout and special characters.

This seems to do a pretty good job of summarizing the philosophical differences between Perl and Python, but I think that the writer makes but ignores an important point. It's true that you want to incorporate structure into some forms of communication and programming, but that doesn't prevent the use of a natural language. After all the air-traffic controlers he mentions are still speaking English- they're just using a controlled syntatic and semantic subset of English. The same thing is true of Perl; if you want to do something rigidly structured, you can limit yourself to a subset of the available semantics and syntax and produce a rigidly structured program.

The converse is not true, though. If you start out with a language with rigidly structured syntax and limited vocabulary, you will have a hard time expressing yourself freely.

The moral is that Perl is a great language for *implementing* haiku... but Python is rather better at implementing functional specs.

And this is a great example of the point. A haiku is nothing if not rigidly structured, but it's quite possible to express both haiku and air-traffic controls using English. A language designed specifically for one or the other, though will never be able to do both.

Re:I must be an exception to the norm :) (2)

scrytch (9198) | more than 14 years ago | (#1267797)

bully for you if you're using emacs. now all i need to whip up a script is an editor that starts at 8 megs. i still fail to be convinced by the whitespace issue, and it is still the main reason i can't stand working in python.

i'm also not fond of its naive scoping rules (i have a slight conceptual disagreement with passing parameters as themselves, e.g. lambda x=x). the list slicing semantics is inconsistent -- 1-based in one slot and zero-based in the other. much of python and perl seem to have been based on "what's good for guido/larry is good for everyone". I guess i identify with larry's warped and confused mind better.

i like cats. when was the last time you had to walk the cat?

Re:How does Python deal with all types of whitespa (3)

gorilla (36491) | more than 14 years ago | (#1267798)

The python camp tends to claim that python is better if there are multiple authors, eg #45 [] .

Having different editor settings is something which different authors often have, this is hardly the first instance where magic white space has caused problems, make being an obvious previous example.

I really don't know why Python programmers reject the concept of bracket characters (or words as in languages like Pascal). In my exprience, when reviewing code it's useful to know what the original author was intending to program, as well as what she actually programmed.

Having syntax markers as well as indentation provides a valuable redundant check which indicates when the thoughts are not matching the code.

If a program has

if(1) {

print "something"
if(2) {
print "something else"
} else {
print "a third thing"
Then I know that there is something wrong with the program. I don't know if the programmer wanted the else to go with the first if or the second, but I do know that he was confused about this section of code.

By removing the {}, you loose that redundant check on the code, and the poor maintence programmer has no clue that this is a suspect portion of code.

In the past I've heard the claim that you could use magic comments in python to indicate your desired indentation. Unfortunatly, almost every production program I've ever seen has had correct indentation, while I've never ever seen a python program with magic comments.

Re:How does Python deal with all types of whitespa (1)

scrytch (9198) | more than 14 years ago | (#1267799)

> Um, actually, why are you using tabs alternated with spaces in the first place?

Why is my code failing to parse because I do?

Re:how to comment perl (2)

Lulu of the Lotus-Ea (3441) | more than 14 years ago | (#1267800)

Amongst other things, if you're paying me to write perl, you're not paying me to write English. If you can't read it, that's your bad lookout.

I don't mean to pick on PigleT here... but I think this attitude is absolutely terrible... even rather iconic of tech mistakes.

If I am hiring someone to write code (in whatever language, this isn't about Perl/Python specifically), I am most certainly also hiring them to write English. I just simply do not want to hire someone whose only strong language is a programming language (rather than also a natural language). If anything, for almost any real-life programming job, the natural language skills are a lot more important to doing the job well than are the programming language skills.

I have inherited a fair amount of code that suffers from just the problem I am pointing at. Programmers who really have quite poor verbal skills, but think of altogether too clever ways of doing a programming job. This is almost completely worthless six months later. And as likely as not, it winds up missing the real business requirements of a given job... since it is only clever programming; not equally clever specification and technical analysis.

Re:Bzzzt...The Winner is Java (2)

rcromwell2 (73488) | more than 14 years ago | (#1267801)

Well, try editing their launching scripts and run them all in the same VM. Or try adding -X parameters to alter the default memory. I run about 6 Java servers on my site: SMTP, POP, Tomcat/Servlets, Enterprise Java Beans, stand alone image generating servlet, and an separate RMI server. The machine has 256Megs of ram and is not stressed (it also runs Oracle8 with 100 instances)

Re:Zope is Pythons Killer App??? (0)

Anonymous Coward | more than 14 years ago | (#1267802)

I can't agree more. Since her pediatrician perscribed it, I give my 2yr old a dropper full of PySol every day.

Re:how to comment perl (1)

C. E. Sum (1065) | more than 14 years ago | (#1267803)

But the reason you write comments is not because you couldn't have read it 6 months ago, but because you think you won't be able to in 6 months' time, or because some other chap won't be able to, surely?
I guess I was trying to imply that similar newbies (even ones who were very familiar with programming in C and Bourne shell, as I was, for example) would have a hard time figuring out what was going on. But a even remotely seasoned Perl programmer would glance by the line and immediately know what was going on. That Perl for you--full of so many great idioms that the uninititated can be thoroughly confused.

I don't believe in comments particularly. I'm firmly of the "if you can't read it and it's valid perl, that's your sad loss" mentality.
Well--what if they can read the Perl, but for some other reason it's not clear what's going on? That's my basic rational for commenting--I assume you syntatically and to some extetent semantically understand what's going on--but it's a lot clearer if I write
# wait for job complete
before some 10 line code that goes out, runs a Unix command, and runs a couple of regexps against it.

But I often feel my need to comment my Perl code beyond that level, to point out the idioms and things . . . Maybe I'm just an insecure Perl coder :-)

Re:Championship bout (1)

kdoherty (2232) | more than 14 years ago | (#1267804)

Interesting post, but I'm not sure I see Larry Wall as Val Venis and Guido van Rossum as Kurt Angle (Guido is certainly no match for MY Olympic Hero!)

I guess CRZ is on one more website now though :)
Kevin Doherty

the one true way (1)

raistlinne (13725) | more than 14 years ago | (#1267805)

The problem with the one true way is that generally everyone else does it the wrong way. And this is not insignificant.

What happens when you are forced to do something the way you don't want to? You are less likely to do it. I am more reluctant to code parts of programs when I don't like how I have to code them. As a result, I have to force myself to do them and to do them properly.

What's the result? Sometimes they don't get done properly. When I was doing java just about every catch block had nothing in it, because it was such a damn pain to do. The result: my code didn't handle error conditions properly - the very result of what what supposed to handle error conditions.

There isn't one true way to do things. When you get down to it, scripting languages themselves are the wrong way to do things. Sure, they save one programmer some hours, but they cost millions of people CPU time. The right way to code is in C, where you are intimiately aware of execution time. Or maybe it isn't. It's great that the python crowd agrees on what the one true way is. I don't agree with them.

There was a language back when that used whitespace to enforce coding - it was called FORTRAN. That language really, really sucks. I've had to work in it. It sucks. Badly. Well, to me. I've heard that there are people who will program in nothing but fortran. Each to his own. But to me, fortran programs were no easier to read. COBOL is supposed to be a nightmare, and it uses whitespace to make things look better.

The point? That not everyone believes that the same way is the right way. Your method may optimize for one thing that I don't think is worth optimizing for. Mine may optimize for something that you don't think worth optimizing for. Other people code out certain functions in assembly just to get some extra speed from their CPUs, and they're optimizing differently from both of us. Which is right? I don't really know. If I had to program in a language which enforced whitespace, I'd probably rip apart the interpreter and rewrite it to use {} the way that most normal programming languages do. There are places where whitespace makes life harder to read. Like a function with lots of arguments, for example. Or an assignment with lots of text. It's a lot better to make exceptions for them in indenting style because they make things more readable.

In the end, any time anyone claims that they know what the one true way is with only negligible amounts of doubt, I start to wonder. You have plenty of very infamous company and just a tiny bit of famous company. And the famous ones all had or claimed to have divine inspiration. Are you going to claim that python was dictaed to guido directly from God or some angel?

Re:Championship bout (2)

sugarman (33437) | more than 14 years ago | (#1267806)

Apprently someone has been spending far too much of their Slashdot-browsing time over at Wrestleline [] instead. I hope you take steps to rectify this in the future, as /. needs all the page-views they can get.

Block structure (1)

josu (144992) | more than 14 years ago | (#1267807)

Okay, Python doesn't have function closures and other funky features

That's half true. And more-than-strongly hints at what I consider Python's biggest flaw to be: lack of block-structure and variable declarations. You can fake it by using default arguments to functions, but it's not all that pleasant.

Python has variable "undeclarations", namely the global statement (basically used to say "I'm not declaring this variable"). In my opinion, an unfortunate feature in an otherwise great language.

Load More Comments
Slashdot Login

Need an Account?

Forgot your password?