Slashdot Mirror


Perl vs. Python: A Culture Comparison

davemabe writes "Every programmer has a favorite scripting language. Here is a well written article by Jon Udell from byte.com 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. "

351 comments

  1. Python parses indentation! by possible · · Score: 1

    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.

    1. Re:Python parses indentation! by Anonymous Coward · · Score: 1

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

    2. Re:Python parses indentation! by benploni · · Score: 1

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

    3. Re:Python parses indentation! by Dj · · Score: 1

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

      --
      "You know you want me baby!" - Crow T Robot
    4. Re:Python parses indentation! by FFFish · · Score: 1

      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.

      --

      --

      --
      Don't like it? Respond with words, not karma.
    5. Re:Python parses indentation! by possible · · Score: 1
      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.

    6. Re:Python parses indentation! by GerritHoll · · Score: 1

      There have been many flame wars on this. Some people like it, some do not. I think it's a good idea.

    7. Re:Python parses indentation! by Anonymous Coward · · Score: 0

      Python was not named after the reptile. It was named after Motny Phyton, the TV show.

    8. Re:Python parses indentation! by pornking · · Score: 1

      That's what I thought until I started using it about a year ago. I think it would really annoy me if I didn't use an editor which could understand it. As it is, I found out that with python mode under Emacs, it easier and more comfortable than having to type all those braces and semicolons.

      If you think the indentation is annoying, I urge you to try it a few times with an editor which has a good python mode. You might still find it annoying, but then again, you might not.

      --
      pornking
    9. Re:Python parses indentation! by Anonymous Coward · · Score: 0

      Never heard of them

  2. How does Python deal with all types of whitespace? by cpeterso · · Score: 2

    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?


  3. Asbestos Underwear Anyone? by EricWright · · Score: 1
    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 ...

    Eric

    1. Re:Asbestos Underwear Anyone? by technos · · Score: 2

      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..

      --
      .sig: Now legally binding!
    2. Re:Asbestos Underwear Anyone? by Industrial+Disease · · Score: 4

      You know, I've never understood why advocates of a language whose motto is, "There's more than one way to do it" take such exception to those who choose to do it in another way.

      --
      Weblogging Considered Harmful:
    3. Re:Asbestos Underwear Anyone? by Anonymous Coward · · Score: 0
      Only because heathen Mongers and ignorant Hackers have yet to find the Language of languages!

      If you give someone Fortran, he has Fortran. If you give someone Lisp, he has any language he pleases. -- Guy L. Steele Jr.

  4. No, Perl! No, Python! Idiot! by jjohn · · Score: 2

    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.

    1. Re:No, Perl! No, Python! Idiot! by Petethelate · · Score: 2
      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?"

      Pete

    2. Re:No, Perl! No, Python! Idiot! by Anonymous Coward · · Score: 0

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

    3. Re:No, Perl! No, Python! Idiot! by Mandi+Walls · · Score: 1
      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...
      --mandi

    4. Re:No, Perl! No, Python! Idiot! by Anonymous Coward · · Score: 0

      Perl has many problems which make it unsuitable for beginners, the biggest being its ludicrous syntax. Rather than english words, bizarre and inconsistent symbols are used. While this might save a few dozen characters, it makes perl programs nearly impossible for anyone other than the author to read.

      It's also definitely not suitable for anything other than small scripts, and teaching young programmers to think of programs as one huge method is a bad idea.

      BTW, just about every language besides C++, Java(C++ 2.0), and Basic works at a higher level.

      I think the world deserves better than perl.

    5. Re:No, Perl! No, Python! Idiot! by Baki · · Score: 1
      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.

      Have you ever used the STL? With that, hashes, maps and other collections are dead-simple. Also you have a nice set of algorithms to apply on them built into the STL. When I first really used it a year ago, I was very impressed. I'm using Java now, but it's container classes are no match for C++/STL.

  5. Re:Cool! by wass · · Score: 1

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

    --

    make world, not war

  6. In the end it was Zope by Bwanazulia · · Score: 1

    The areticle does talk a lot about Perl and Python but in the end ends up talking about the Python Killer App, Zope http://www.zope.org 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

    1. Re:In the end it was Zope by Bouncings · · Score: 2

      oh yeah. Zope is what Cold Fusion tries hard to do. I've been using Zope for APP development and it is truely a pleasure. Check out technocrat.net, which is IMHO, a great example of a well-done ZOPE application.

      --
      -- Ken Kinder ken@_nospam_kenkinder.com http://kenkinder.com/
  7. JPython? by mnf999 · · Score: 1

    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.

    --
    The real mnf999 always posts as anonymous coward
    1. Re:JPython? by jovlinger · · Score: 2

      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.

    2. Re:JPython? by benploni · · Score: 1

      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.

    3. Re:JPython? by AMK · · Score: 2
      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.

    4. Re:JPython? by Anonymous Coward · · Score: 0

      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.

    5. Re:JPython? by mnf999 · · Score: 1
      The guy wrote wrote TCL tried once in a paper to define what is a scripting language, but it's still rather fuzzy.

      I beg to differ. The article you mention is here and is the inpiration for some of my recent work... It is pretty obvious (as I work on EJB) that scripting is the way to go (as opposed to Compilers like AspectJ from Xerox PARC, or even the pure graph of XML information as in the case of EJB).

      --
      The real mnf999 always posts as anonymous coward
    6. Re:JPython? by Edward+Kmett · · Score: 1
      Python makes a very good scripting language when you get beyond munging text. I choose to use Python in the contexts that I do because of what the language gives me, it compiles to bytecode, the interpreter is easily embeddable, SWIG gives me shadow classes for all my C++ classes, which I can then extend in python and actually call into the python code through the extended interfaces. The ability to distribute code in bytecode form means you don't have to open your source if you don't want to, and it has a security module, much like java so you can lock script-writers into a sandbox when you are embedding in a game environment.

      The downside of python (and jpython) is the speed of execution. Perl runs circles around Python in all my tests.

      JPython compiles to Java bytecode which lets me leverage java technologies (the security api, servlets, etc) whereas Stackless Python gives support for first class continuations (coroutines).

      At this stage, JPython is winning for me, because even though my execution slows down I can move to java where speed becomes an issue and to C++ where it becomes critical.

      I can't run Perl in a sandbox if I don't trust the perl developer. I can clamp down pretty hard on Python however, which is important to me for openWar. (I think you can guess the gist of the project)

      Also, when using a lot of objects Python's syntax is less quirky than Perl's, which makes me feel safer bringing in other developers with limited knowledge of the language.

      If you bring in a newbie Perl programmer, Perl object syntax usually seems incredibly arbitrary (until they've gone through how hash's work and blessings, etc) If you bring in a newbie Python programmer, the object syntax is pretty intuitive, no worries about when to use {} and ->{}, etc.

      I use both languages, but I find Perl to be effective when I'm writing highly text oriented code, or scripts, and Python when I need the sandbox and heavy access to C++ objects and an oop framework.

      --
      Sanity is a sandbox. I prefer the swings.
  8. BOTH SUCK! by Anonymous Coward · · Score: 0

    UnrealScript RULEZ!

  9. Re:How does Python deal with all types of whitespa by seoman70 · · Score: 1

    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.

    --

    [Seoman] "A conclusion is simply the place where you got tired of thinking."

  10. awww yeah by Nastard · · Score: 0

    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.

    1. Re:awww yeah by Nastard · · Score: 1

      flamebait ? it was supposed to be funny.

  11. Order vs Disorder by grrussel · · Score: 2

    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

    1. Re:Order vs Disorder by Stigma · · Score: 3

      > 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.

    2. Re:Order vs Disorder by glyph · · Score: 4
      Since we seem to be resorting to the arguement by authority, this is from someone with extensive experience with both perl and python. I am writing a large application in python, and I'm very pleased with it, and I've written several large applications in perl in the past.
      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.
      Yes, you're correct. It's also possible to write correct, clean, fast programs in x86 assembler. One could even argue that it is equally possible to write everything directly to ELF binary format. -- decent hex-editors exist, and the format is well defined. However, the whole point of language design is to encourage certain practices, not to make them possible. Python encourages writing clean, consistent code. This makes it easier to deal with. If your code is formatted in a very specific style and written consistently, it's more likely that it will be correct, although it's not garuanteed.
      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.

      $x->{'y'} versus x.y -- and let's not forget about x.__class__=mypackage.MyClass. Can you even do the latter in perl?

      The distinction seems pretty clear to me... perl's class / package syntax is MUCH obviously cruftier. If you think that it's not ... well, then use perl for OOP. We disagree.

      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.
      Have you ever tried to read befunge, or brainf***? I know these languages, and this is certainly NOT true for them. Perl also makes heavy use of punctuation marks to mean things which are not only not immediately obvious, they can be confusing. In fact, a quote from Larry Wall himself is "admittedly, readability suffers..."

      Perl is not as readable as python. If you don't have any trouble reading perl, that's anecdotal evidence... there is a statistically significant number of people who don't have any problems -- and in fact, enjoy -- reading python (read the python mailinglists, or c.l.python, or www.python.org, or #python on IRC... I've been to the perl equivalents, and I've never seen them advertising readability or maintainability), because it was designed to encourage that. This doesn't mean perl is worthless: it's a language feature of python to be consistent and easy to read. It is a language feature of perl to be terse and easy to write.

      Finally, consider this python statement: x=['a','b',{'c':'d','e':['f','g']},['h',['i','j']] ]. I admit that perhaps I'm not the swiftest perl programmer ever, but it is certainly not that easy to make a data structure which is a list of strings, hashes of strings and lists, and lists of lists in perl. The syntax gets really hideous and doesn't mean what it looks like it should. (I can't even come up with a way to write that in perl on they short notice required for posting this comment: perhaps a better perl hacker than I can elucidate..)

      --
      Glyph Lefkowitz - Project leader, Twisted Matrix Labs
      Writer, Programmer - Not a member of the TSU
    3. Re:Order vs Disorder by Khelder · · Score: 1

      For an occasional scripter, I think Python is hands down easier to read than Perl (and not because of indentation).

      Maybe the problem is that I only use Perl infrequently and haven't written anything really big in it, but I often have trouble remembering how to build and access data structures the way I want to. I don't have this problem in Python, C++ (not that I use it often, either), Java, or awk. I often want to do things like make an array of hash tables or a hash table of arrays. In Python these things compose in the obvious way. In Perl, they do not.

    4. Re:Order vs Disorder by JordanH · · Score: 3
      • 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.


      And I'm sick of all these dismissive oversimplifications of a complex issue.

      Some languages lend themselves more to readability than others.

      Admittedly, readability has as much to do with the reader than it does with the writer, but there are some attributes of a programming language that make it more readable when the readers are most human programmers who might try to modify code.

      For example, I can parse and completely understand the semantics of simple aritmetic more easily than I can most English prose. This is true, even though I spend probably a minumum of 1000 times more time practicing writing and reading English than I do with arithmetic. Thus, it's not a matter simply of experience with the language.

      English prose is far more expressive and powerful and completely contains all the expression and power of simple arithmetic.

      The TIMTOWTDI nature of Perl leads to a lot of different ways to express a program. To understand the semantics of a Perl program one might have to think in a number of different idioms. Depending on the original author, the different styles and idioms might cover a large subset of the language in a given program, and Perl is a "big" language, with lots of odd corners.

      Here's an extract from a discussion I was involved in a few years back in comp.lang.perl.misc with none other than the redoubtable Randall Scwartz that I think helps illustrate the point I'm trying to make:


      • >>>>> "Jordan" == Jordan Henderson writes:
        Jordan> For example, say I want to extract preformatted text from an HTML
        Jordan> file. Note that this is not a general purpose preformatted-text-
        Jordan> extractor, but it's handy for files where I can guarantee the
        Jordan> format (in a case where I wrote the original HTML file with another
        Jordan> program, for example):


        Jordan> while () {
        Jordan> last if /^/;
        Jordan> }
        Jordan> if (eof) die "HTML format bad, couldn't locate preformatted text.";


        Jordan> while () {
        Jordan> last if /^/;
        Jordan> print;
        Jordan> }
        Jordan> if (eof)
        Jordan> die "HTML format bad, couldn't locate end of preformatted text.";
        Jordan> Is there a better, clearer way to do this sort of thing?


        I usually write something like this:


        $found = 0;
        while () {
        $where = //..//;
        $found = 1, print if $where;
        last if $where =~ /E/;
        }
        die "we didn't find it!" unless $found;


        print "Just another Perl hacker,"
        --
        Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
        Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
        Email: Snail: (Call)
        PGP-Key: (finger merlyn@teleport.com)
        Web: My Home Page!
        Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


      Now, I was somewhat of a Perl newbie and I'm still nowhere nearly at the level of a Randall Schwartz, but I had a hard time with Randall's answer at the time. I was familiar with the .. operator, but had never used it.

      I still feel that my original attempt using the eof operator was simple and very readable. I also love the elegance of Randall's solution.

      See, I like Perl, I really do. It's very expressive. Randall's solution points to many other opportunities for good use of the .. operator. I don't think it's the most readable, in this case.

      There's the rub. The most readable solution may not use the most expressive idioms. Readability isn't the only criteria on which to judge a work. Shakespeare is harder to read than Suess, but I don't want to be limited to a Suess-like style in my own writing

      However, I'm sympathetic to the camp that seems to believe that computer languages should not have the same ambiguities and expressive power than natural languages. In some settings, it may be more productive to use languages with a more limited selection of possible idioms.

      For example, I might prefer that an Air Traffic Control system be written in Ada rather than Perl. I want the maintainer of that code to be able to immediately and completely grasp the semantics of the code in front of him or her. I want the maintainer to be immediately comfortable with the style and choice of idioms.

      Horses for Courses. Perl still excels in it's adaptability, it's functionality and it's expressive power. Python may excel in simplicity, it's applicability to programming language education and it's readability. I don't actually know Python so forgive me if I misrepresent it.

      I'm glad I have simple arithmetic for some things. I'd hate to have to express number problems in English. I prefer "2 + 17 = 19" to "Two plus seventeen equals nineteen."


      -Jordan Henderson

    5. Re:Order vs Disorder by Raevnos · · Score: 1
      Well, I don't really know python, but x.__class__=mypackage.MyClass appears to be something that changes the class of x. The perl equilivant is bless $x, "NewClassName".

      Lists of strings and hashes of strings and lists are just as easy in perl as your python example. In fact, the syntax is almost the same ('=>' or ',' instead of ':').

      And PLEASE don't blame the language for unreadable code unless it's intercal or the like. Place the blame where it belongs, with the programmer. I'm sick of people saying perl is unreadable and then brandishing about something written by someone who's never touched the language before - or an entry for an obfuscated code contest. The same goes for any language of course. The poster you replied too was right about code readability.

      They're both powerful, useful languages. Some people like perl. Some people like python. Some like both. Some don't like either. Great! Use what works best for you.

    6. Re:Order vs Disorder by nosferatu-man · · Score: 3
      $x->{'y'} versus x.y -- and let's not forget about x.__class__=mypackage.MyClass. Can you even do the latter in perl?

      Yeah, use bless. But your point is well taken. Perl's OO stuff is pretty much roll-your-own, which is great except when it sucks. I love Perl, but at times it's so crufty that I immediately revert to Scheme.

      I admit that perhaps I'm not the swiftest perl programmer ever, but it is certainly not that easy to make a data structure which is a list of strings, hashes of strings and lists, and lists of lists in perl

      Well, actually, it's pretty straightforward:

      $x = [ 'a', 'b', { c => 'd', e => [ 'f', 'g' ] }, [ 'h', ['i', 'j' ] ];

      The syntax is fairly clean, I think (although it does look much nicer when properly indented and formatted), although accessing it can be uglier:

      $bar = $x->[ 2 ]->{ e }->[ 1 ]; # yields 'g'

      One striking thing about Perl that I haven't seen in other language communities is the ease with which experienced programmers almost unconciously create personal dialects of the language. This is great for writing code, much less great for, say, fixing it. There are so many weird tricks possible, such a rich idiom, that it's natural to recycle exceptionally clever bits, sometimes (often?) to the detriment of readibility

      In any event, both languages are fun to code in, and can certainly peacefully co-exist.

      Cheers,

      (jfb)
      --
      To spur "enterprise Linux," Big Bang, the distributed two-phase commit.
    7. Re:Order vs Disorder by Anonymous Coward · · Score: 0

      You wrote:

      > x=['a','b',{'c':'d','e':['f','g']},['h',['i','j']] ]

      Is this a trick question, or have I misunderstood
      the Python? Assuming that {'c':'d'} creates
      a hash table, the perl equivalent should be:

      $x=['a','b',{c=>'d',e=>['f','g']},['h',['i','j'] ]];

    8. Re:Order vs Disorder by Anonymous Coward · · Score: 0

      >consider this python statement:
      >x=['a','b',{'c':'d','e':['f','g']},['h',['i','j ']]]

      >(I can't even come up
      >with a way to write that in perl on they short
      >notice required for posting this comment: perhaps
      >a better perl hacker than I
      >can elucidate..)

      and you said ou have written several large apps in Perl? I'll elucidate. In Perl, it's:
      $x= ['a','b',{c=>'d',e=>['f','g']},['h',['i','j']]];

      If you like trees, see

      http://xahlee.org/PerlMathematica_dir/perlMathem atica.html

      Perl is a language by morons for morons.

      Xah
      xah@xahlee.org
      http://xahlee.org/PageTwo_dir/more.html

    9. Re:Order vs Disorder by Richard+Jones · · Score: 1

      > 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.

      Class attributes. No, not package variables, but OO class attributes. I'm sick and tired of having
      to have:

      sub fakeClassAttribute {"StringClassAttribute;"}

      so a base class can access an attribute of an implementation class.

      Richard

    10. Re:Order vs Disorder by Anonymous Coward · · Score: 0

      In a world where people can't even program their vcrs, I doubt that people who either created Perl or code in it are morons.

    11. Re:Order vs Disorder by Anonymous Coward · · Score: 0

      >In a world where people can't even program their vcrs, I doubt that people who either created Perl or code in it are morons.

      well there's different level of moroncity. After all, Perl coders are still coders. Better than typists, say. If a philosopher calls another philosopher a moron, it does not mean the guy is thought as stupider than the most intelligent garbage collector.

      besides, the programing vcr is a totally different issues. It's not the people, it's the vcr designer. If you force the analogy, you can say that stupid people create stupid technologies.

      Xah
      xah@xahlee.org
      http://xahlee.org/PageTwo_dir/more.html

    12. Re:Order vs Disorder by joey · · Score: 1
      Finally, consider this python statement: x=['a','b',{'c':'d','e':['f','g']},['h',['i','j']] ]. I admit that perhaps I'm not the swiftest perl programmer ever, but it is certainly not that easy to make a data structure which is a list of strings, hashes of strings and lists, and lists of lists in perl.

      Amazingly, your code above is almost exactly how one does it in perl:

      $x=['a','b',{'c' => 'd','e' => ['f','g']},['h',['i','j']]]

      The problem is that most people who make statements like you did are completly unaware of perl's [] syntax.

      As for OOP in perl -- the amazing thing about perl's approach to OOP is it gives you complete fexability as to which varient of OOP you want to use. Can classless OOP (the variety of OOP used in LambdaMOO) be implmented in python? It can in perl.. Granted, this is completly useless to the beginner, but guess which language I choose to implement a lambdamoo clone in?
      --

      --
      see shy jo
    13. Re:Order vs Disorder by sholden · · Score: 1
      perl to be terse and easy to write. Finally, consider this python statement: x=['a','b',{'c':'d','e':['f','g']},['h',['i','j']] ]. I admit that perhaps I'm not the swiftest perl programmer ever, but it is certainly not that easy to make a data structure which is a list of strings, hashes of strings and lists, and lists of lists in perl.

      You mean like:
      @x=('a','b',{'c'=>'d','e'=>['f','g']},['h',['i','j ']]);

      Looks almost the same to me... Coule get it even closer with:
      $x=['a','b',{'c'=>'d','e'=>['f','g']},['h',['i','j ']]];

      So we write it the same way in perl and python.

      As for the rest of your post you really should take a look at 'Object Oriented Perl' by Damian Conway. I think you'll find perl does everything you could want from an OO design point of view simply and painlessly.

      Have you ever tried to read befunge, or brainf***? I know these languages, and this is certainly NOT true for them. Perl also makes heavy use of punctuation marks to mean things which are not only not immediately obvious, they can be confusing. In fact, a quote from Larry Wall himself is "admittedly, readability suffers..."

      OK what use of punctuation in perl isn't obvious?

      Quoting out of context doesn't achieve much.

    14. Re:Order vs Disorder by Abigail-II · · Score: 2
      $x->{'y'} versus x.y -- and let's not forget about x.__class__=mypackage.MyClass. Can you even do the latter in perl?

      $x->{'y'} isn't the same as x.y. $x->{'y'} indexes in a references to a hash (dictionairy). In Python, all you have is a reference anyway, and you would index it as x ["y"]. A bit shorter than the Perl equivalent, but in Perl you can drop the quotes. But in Perl, you can easily embed the $x->{'y'} in a string, which you can't in Python.

      As for x.__class__=mypackage.MyClass, in Perl you would bless a variable into a class. Not a significant difference.

      Perl also makes heavy use of punctuation marks to mean things which are not only not immediately obvious, they can be confusing.

      Oh, yeah, right, punctuation is scary, confusing, and makes thing difficult to read. Take a novel, for instance "Oliver Twist" by Charles Dickens. Now, remove all punctuation in the book. Does it become easier to read? Would it become easier to read if you replace the punctuation by something else? I don't think so. Your example above of x.__class__=mypackage.MyClass contains 7 punctuation characters. The Perl equivalent bless $x, mypackage::MyClass contains 4, 42% less punctuation characters. Python uses puctuation characters as well, and they aren't exactly rare either.

      Perl is not as readable as python

      Bollocks. There's a lot of bad Perl out there. But that isn't due to the language, it's due to the programmer. If you know the language, and you don't have a sucky programmer, Perl is as readable as Python is, for someone who knows the language, and has code written by a competent programmer. Of course, there are people that will claim that Chekhov isn't as readable as Hemingway, when they just mean they don't understand Russian.

      I've been to the perl equivalents, and I've never seen them advertising readability or maintainability

      Perhaps you should read some of the documentation that comes with Perl then. For instance, perlstyle(1). I'd like to point out to a Python equivalent, but my Python 1.5.2 came with a whopping 8k of documentation compared to the several megabytes of Perl documentation. (Yes, I am aware of that you need to separately install it, but python.org doesn't have plain text or man page formats for the docs - oouch).

      x=['a','b',{'c':'d','e':['f','g']},['h',['i','j']] ]

      Djee, that's almost what you would write in Perl. Minimal changes needed: $x = ['a', 'b', {'c' => 'd', 'e' => ['f', 'g']}, ['h', ['i', 'j']]]

      The syntax gets really hideous and doesn't mean what it looks like it should.

      Well, since it almost looks the same as Python, should we conclude then that Python is as unreadable as Perl? Or maybe you should learn a bit more Perl before you write things like this again.

      There's a lot that needs to be improved in Perl, but readability isn't one of them.

      -- Abigail

    15. Re:Order vs Disorder by Abigail-II · · Score: 2
      For an occasional scripter, I think Python is hands down easier to read than Perl (and not because of indentation)

      But the occasional scripter is irrelevant. That's like saying "Korean is easier to read for the occasional Western tourist than Japanese". It's a meaningless statement.

      I often want to do things like make an array of hash tables or a hash table of arrays. In Python these things compose in the obvious way. In Perl, they do not.

      Strange. I must be doing something wrong then. Each time I look at Python, I think "they build nested datastructures almost same way as in Perl". The most important thing to remember is that in Python you have by default a reference to an array or a dictionary and have to use extra punctuation if you want a copy of the values, where in Perl it's the other way around. Although you can do it all with references in Perl without using more punctuation.

      -- Abigail

    16. Re:Order vs Disorder by Eric+E.+Coe · · Score: 1
      Actually, there is a shorter way to express that chain of dereferences:

      $bar = $x->[2]{e}[1]; # Yields 'g'
      This looks a lot nicer, huh?
      --
      --
      An esoteric scratched itch:
      Homeworld Map Maker Tool
    17. Re:Order vs Disorder by maraist · · Score: 1

      *Finally, consider this python statement: x=['a','b',{'c':'d','e':['f','g']},['h',['i','j']] ].

      Try
      $r_x = [ 'a', 'b', { c => 'd', e => [ 'f', 'g' ] }, [ 'h', [ 'i', 'j' ] ] ]

      What's the problem????

      On OOP, I agree that Perl's backwardly compatible method is akin to the P-III's x86 mess. Still with Perl5.005, you are capable of performing most OOP operations.
      namely:
      the pseudo-hash's ability to stricly enforce hash contents, and to provide private class variables.
      local var strict Data-typing based on class names. ( ie "my Base::FooClass $x = new Base::FooClass" )

      Unfortunately, my main reason for using perl is the vast feature set ( CPAN, integration with Apache, support for QT, Gnome, GL, etc ). If python were that supported, I would probably switch over in a heart beat. It is good to reinvent yourself every now and again..

      A lesser used purpose of perl for me is for quick and powerful command-lines or shell scripting. I completely believe Perl is best suited for this, and I do not see python as a replacement here. The idiocyncracies of perl really shine in a shell environment, and I believe this to be the major problem with most programmers.. Shell attributes do not regularly lend themselves to general purpose programmers, who then label perl as cryptic.

      To fully appretiate perl, you must reguarly perform such system administrative functions.

      --
      -Michael
    18. Re:Order vs Disorder by maraist · · Score: 1

      * $bar = $x->[ 2 ]->{ e }->[ 1 ]; # yields 'g'

      Even easier:
      $bar = $x->[ 2 ]{ e }[ 1 ];

      --
      -Michael
    19. Re:Order vs Disorder by Khelder · · Score: 1
      But the occasional scripter is irrelevant. That's like saying "Korean is easier to read for the occasional Western tourist than Japanese". It's a meaningless statement.

      I disagree. It is important to the tourist whether Korean or Japanese is easier and if there are thousands (or millions) of potential tourists, it should be important to people who care about how many tourists visit their country. Also, I think the analogy would be better if it were business people instead of tourists, since I was thinking of people who script on a regular but infrequent basis (and to me tourist implies a one or two-time visitor, not a regular visitor).

      I don't know how many webmasters (to pick a particular application domain) become power users as opposed to occasional users, but I believe that there are a substantial number of both.

      As for which is more intuitive, I guess it depends on what you're used to and on your own personality/perceptions. I find Python's synatx for data structures much more similar than Perl's to languages I know best (C/C++, Java).

    20. Re:Order vs Disorder by Abigail-II · · Score: 2
      I disagree. It is important to the tourist whether Korean or Japanese is easier and if there are thousands (or millions) of potential tourists, it should be important to people who care about how many tourists visit their country.

      Care to point out a country who designed their language such that it would attract more tourists? Or, since languages tend to be established a while ago, has a organizing body steering the language such that it makes it easier for tourists?

      My point it that languages aren't made for tourists, languages are made for users.

      -- Abigail

  12. Vs. by Anonymous Coward · · Score: 0

    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.

  13. cootchie-coo by vyesue · · Score: 1

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

    1. Re:cootchie-coo by S�gnal+ll · · Score: 1

      Thank God, someone is finally bringing some
      rationality to this discussion.

  14. Perl and Python Databases by akgoel · · Score: 1

    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?

    1. Re:Perl and Python Databases by tincho · · Score: 1

      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).

    2. Re:Perl and Python Databases by Anonymous Coward · · Score: 0

      don't move, stick to the DAO. it is too hard for you to do P & P.

    3. Re:Perl and Python Databases by akgoel · · Score: 1

      Some people have to work within the confines of the software and tools they are given. Deal with it.

    4. Re:Perl and Python Databases by akgoel · · Score: 1

      Thanks.

    5. Re:Perl and Python Databases by KFW · · Score: 1
      O'Reilly just released a book Python Programming on Win32. There is a chapter on databases, and the table of contents indicates that it discusses DAO and ADO.

      I've just started learning Python (I'm workin on another ORA book, Learning Python) but hope to use it for some Windows programming. The PythonWin environment is very easy to use. Look at www.python.org for more info.

      HTH
      >K

    6. Re:Perl and Python Databases by Malcontent · · Score: 1

      Yes. Both languages can act on COM object with the same ease as VB. I still use VB for gui stuff but I never use it for non gui data manipulation anymore. Perl is much faster and easier. When is somebody going to give me visual perl.

      --

      War is necrophilia.

  15. Python rocks by Anonymous Coward · · Score: 0

    At least Python has a better namesake.

  16. His signature is wrong by Anonymous Coward · · Score: 0

    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.

    1. Re:His signature is wrong by fuddmain · · Score: 1

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

    2. Re:His signature is wrong by Anonymous Coward · · Score: 0

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

    3. Re:His signature is wrong by Anonymous Coward · · Score: 0

      Oh. Thank you for the correction. I am now signing off the internet forever.

      Bye...

  17. Bzzzt...The Winner is Java by Anonymous Coward · · Score: 0

    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.

    1. Re:Bzzzt...The Winner is Java by bssea · · Score: 1

      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

    2. Re:Bzzzt...The Winner is Java by mwa · · Score: 1
      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..

    3. Re:Bzzzt...The Winner is Java by rcromwell2 · · Score: 2


      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)

  18. tickle yourself :) by Anonymous Coward · · Score: 0

    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}

  19. agreed by Anonymous Coward · · Score: 0

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

  20. Re:When Will You Upgrade To Windows 2000? by screeching+weasel · · Score: 0

    no.

  21. Re:How does Python deal with all types of whitespa by benploni · · Score: 2

    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.

  22. python ==great to know by kb9vcr · · Score: 2

    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)

  23. Re:Perl RULES! by SethJ · · Score: 0

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

  24. Oh, thanks, Slashdot. by FFFish · · Score: 1

    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.


    --

    --

    --
    Don't like it? Respond with words, not karma.
    1. Re:Oh, thanks, Slashdot. by J.+J.+Ramsey · · Score: 1

      "Perl seems to be based on accomplishing as much
      as possible using as few keystrokes as possible."

      Actually, Perl was more-or-less a more powerful replacement for the sed, awk & shell combo. The Perl syntax borrows a lot from shell scripting languages, which is probably why you see stuff like "$_" in Perl, which is reminiscent of built-in shell variables like $? and $#. That probably explains why Perl looks as it does.

  25. Re:How does Python deal with all types of whitespa by Anonymous+Shepherd · · Score: 2

    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...)

    -AS

    --

    -AS
    *Pikachu*
  26. Indentation by jerky · · Score: 2

    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.

    1. Re:Indentation by Anonymous Coward · · Score: 0

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

    2. Re:Indentation by glyph · · Score: 1

      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.

      --
      Glyph Lefkowitz - Project leader, Twisted Matrix Labs
      Writer, Programmer - Not a member of the TSU
    3. Re:Indentation by Anonymous Coward · · Score: 1

      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

    4. Re:Indentation by jerky · · Score: 1

      When I talked about "cut-n-paste", I wasn't talking about duplication code. In fact, I was talking about exactly the kind of things Refactoring is about: when you say, "oops, this code shouldn't be here, it should be in another subroutine." In Python, that's followed by, "oops, that code was 12 spaces to the left of where it needs to be now in its previous location -- no, I mean 8 spaces -- wait, what do I mean?" In most other languages, the editor can figure it out for me, but in Python, since the indentation carries meaning, it can't be done automatically.

    5. Re:Indentation by jerky · · Score: 1

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


      No, it doesn't, because there is often more than one valid way to indent a region, and each way means something different. There always has to be a step when moving code inside a program where you tell the editor what the new indentation will be.


    6. Re:Indentation by jerky · · Score: 1

      you should never ever copy and paste code!


      I agree, but I said cut and paste. For example you mention one case: you realize some code should be in an object or subroutine. So you cut it, paste it elsewhere, and then have an extra step of reformatting. You may be different, but when I program I frequently discover places like this where the design can be improved after I start writing code.


      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.


      I guess I didn't say exactly what I meant. I was really referring to the case where you have:


      a=first_object.verbose_method_name(b,c)+second_obj ect.well_documented_method_name(d )/appropriate_scale_factor


      If I want to break that line up, I need to put in \s or python gets confused; if I end up reformatting it, I have to move the \s around. Unnecessary hassle.

    7. Re:Indentation by Sir+Robin · · Score: 1
      I guess I didn't say exactly what I meant. I was really referring to the case where you have:

      a=first_object.verbose_method_name(b,c)+second_obj ect.well_documented_method_name(d)/appro priate_scale_factor

      If I want to break that line up, I need to put in \s or python gets confused; if I end up reformatting it, I have to move the \s around. Unnecessary hassle.

      I agree, that's a drag.

      On the other hand, it's been a while since I read Programming Python, but in the few lines of Python I've written since then, when I have to break a line, I say something like

      a = (first_object.verbose_method_name(b,c)
      + second_object.well_documented_method_name(d) / appropriate_scale_factor)

      Which is slightly less hassle to deal with the next time you cut-and-paste, anyway. :)
      --
      My /. ID is only 5,210 away from Bruce Perens's.
  27. Perl Can Get Messy by Anonymous Coward · · Score: 0

    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!

    1. Re:Perl Can Get Messy by Anonymous Coward · · Score: 0

      That was &%#@ing genius!

    2. Re:Perl Can Get Messy by Anonymous Coward · · Score: 0

      Thank you,

      It was hard to type my account as I am spent after working so diligently at trying to produce a perl necklace with which to suffocate my girlfriend.

      Unfortunately, the perl necklace didn't work out, and can safely be considered a wasted effort.

      Fortunately, I have my python to thank for quickly and efficiently turning my girlfriend blue. I was feeling rather generous earlier, and I should only go so far as to say that he won't be needing to eat again for another two or three months.

      I was also kind enough to clean the perl necklace first, because he is a masculine python!

      Again, Thanks Python!

  28. It has quite some advantages by Krollekop · · Score: 2

    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.

    1. Re:It has quite some advantages by possible · · Score: 2
      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.

    2. Re:It has quite some advantages by churchr · · Score: 1

      > 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.

    3. Re:It has quite some advantages by Anonymous Coward · · Score: 0
      Saving keystrokes is not of primary importance to most programmers

      Uh...yeah. So tell me again why K and R included the ++ and += operators in C ?

      Anonymous Kevin

    4. Re:It has quite some advantages by Anonymous Coward · · Score: 0

      Because if you're optimizing things for the compiler (rather than the other way around), that tells it that it can load and store to the same register.

    5. Re:It has quite some advantages by Bouncings · · Score: 1
      Generally you get arround this by putting everything in spaces, not tab characters. Should you get a script with undesirable tab characters, you can use a program called tabnanny to correct them. It's a hastle if you're using some weak text editor like pico or notepad, but inside emacs' python-mode or idle (Guido's very own Python IDE) problems don't arrise.

      When it comes down to it, most python programmers find the whitespac syntax to be more good than bad. It certainly makes for nice looking code.

      --
      -- Ken Kinder ken@_nospam_kenkinder.com http://kenkinder.com/
  29. Closures? by hooha · · Score: 1

    Does Python implement closures properly yet? If not, I'll stick to my favourite language Objective CAML: http://caml.inria.fr/

    1. Re:Closures? by burris · · Score: 2

      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...

      ftp://ftp.cs.usyd.edu.au/jskaller/viper_2_0_a1.t ar.gz

      What is wrong with closures in CPython?

      Burris

    2. Re:Closures? by hooha · · Score: 1
      I was under the impression that Python doesn't implement closures properly. The Perl FAQ says:
      Closures make sense in any programming language where you can have the return value of a function be itself a function, as you can in Perl. Note that some languages provide anonymous functions but are not capable of providing proper closures; the Python language, for example.

      The Linux Journal interview with van Rossum last year (sorry, don't have a reference to hand) wasn't very encouraging either. It gave the impression that he met several new concepts (such as closures) whilst working at a university for a short time, and then created Python based on his first impressions of those concepts. I'd prefer to use a language which has been thought through more carefully than that.

      At least Perl is consistently messy! :-)

      I'm not a fan of enforced indentation for block structure either. I've used it in Gofer, Haskell, and Occam. Not again, thanks!

      Thanks for the pointer to Python in OCaml. That does encourage me to use Python!

  30. Re:How does Python deal with all types of whitespa by glyph · · Score: 1

    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.

    --
    Glyph Lefkowitz - Project leader, Twisted Matrix Labs
    Writer, Programmer - Not a member of the TSU
  31. BYTE is still around?!? by soybean · · Score: 1

    Wow, I had no idea.

  32. and Another Thing... by Kailden · · Score: 2

    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.

    --
    I need a TiVo for my car. Pause live traffic now.
  33. Why I chose Python by tjgrant · · Score: 1

    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,

    --

    Stand Fast,
    tjg.

  34. Re:How does Python deal with all types of whitespa by Drinky+Crow · · Score: 1

    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.

    --

    dook, dook, dook!

  35. Championship bout by 348 · · Score: 3
    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?

    --

    More race stuff in one place,
    than any one place on the net.

    1. Re:Championship bout by benploni · · Score: 1

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

    2. Re:Championship bout by kdoherty · · Score: 1

      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
      kdoherty+slashdot@jurai.net

      --
      Kevin Doherty
      kdoherty+slashdot@jurai.net
    3. Re:Championship bout by sugarman · · Score: 2

      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.

      --
      --sugarman--
    4. Re:Championship bout by tweek · · Score: 1

      The three I's of python:
      Indentation
      Indentation
      Indentation

      ;) I couldn't resist

      --
      "Fighting the underpants gnomes since 1998!" "Bruce Schneier knows the state of schroedinger's cat"
    5. Re:Championship bout by tweek · · Score: 1

      BAh....fsck wrestleline....Scoops is the way to go. I just wish Hyatte would come back.

      --
      "Fighting the underpants gnomes since 1998!" "Bruce Schneier knows the state of schroedinger's cat"
  36. Natural Languages and P--- Languages by Lulu+of+the+Lotus-Ea · · Score: 5

    Re: Jon Udell's: "A Perl Hacker in the Land of Python" (http://www.byte.com/feature/BYT20000201S0001)

    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
    specs.

    Yours, Lulu...

    1. Re:Natural Languages and P--- Languages by rgmoore · · Score: 2
      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.

      --

      There's no point in questioning authority if you aren't going to listen to the answers.

    2. Re:Natural Languages and P--- Languages by toolo · · Score: 1

      >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.

      Some people like to be spoonfed, others like to
      learn the "proper way" on their own.

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

      I love how people think that an opinion ==
      fact. When I use Python, I feel like I'm
      using Visual C++. This is my OPINION. This
      does not mean that ANYONE THAT EXISTS OTHER
      THAN MYSELF feels this way.

      However, any language can be created in an
      understable fashion if one takes the time to
      do so. Do technical writers and novelists
      write books in slang? No. They do not.

      What you are saying is based on the _human_
      factor. I can drive off of a bridge if I
      wanted to. The performance of my vehicle has
      absolutely _nothing_ to do with my decision.

    3. Re:Natural Languages and P--- Languages by Master+of+Kode+Fu · · Score: 5
      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!

      Oh, you asked for it now...

      Haiku
      JFK Junior
      Angle is too steep, pull up
      Shit, call the coast guard

      The Love Song of J. Alfred Pilot
      Let us go then, flight 355
      The 747 looks at the stretching sky
      Like a patient etherised upon a table...

    4. Re:Natural Languages and P--- Languages by homunq · · Score: 2

      Swissair one-one-one
      is declaring pan pan pan
      smoke in the cockpit

      You should look into Oulipo, a literary movement dedicated to the idea that arbitrary constraints are actually a path to greater (more fundamental) creativity. Haiku are an earlier form of the same idea. Both have significant natural hacker appeal (although neither counts English as its native language).

      In other words, python R0012, perl sucks, bee-otch.

    5. Re:Natural Languages and P--- Languages by xeer0 · · Score: 2

      While I agree with the vast majority of what you say, I think you are overstating it here:

      "but I finally pinned down what I think is wrong with Wall's initially rather intriguing 'philosophy'"

      To me the thing is that in programming languages, both the flexibility of a Perl and the regularity of a Python have their place. Just as in natural languages slang and say "medical terminology" or other highly formalized modes have a place.

      It may seem at first that in programming a highly formalized language would always be better, since as you point out many times we are trying to precisely implement some spec or other. That begs the question though 'Which do you write more often, programs or prototypes of programs?' I find that I spend alot of times writing prototypes, in a very loose way, that I later refine into a much more formalized program, often in a much stricter language.

      Another thing to think about, is that in natural languages many of these highly formalized modes are subsets of a big mess like say English. Perl and alot of other 'messy' computer languages show some notion of this with their pragmas like 'strict'. Maybe some of these more formal languages like Python need a pragma like 'loose' which says, "Let me indent anyway I want, and shine the type-checking 'cuz I'm just talking to myself"? :)

      --
      "Hey... don't be mean." --Buckaroo Banzai
    6. Re:Natural Languages and P--- Languages by moore · · Score: 1
      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!
      The problime is that once you get past the learning stage of a language this no longer holds true In the way you think. You are right that well defined sublanguges are imporant for code maintance but a compilar *CAN NOT* enforce this. The only way to have clean clear code is to have riger in your programing. I program in perl and python and some of the things I have done in python would make its pundents cry. Any ridged structer can be abused. The difrance is that when I am programing in perl I am never FORCED to do somthing ugly; in python in contrast there have been cases where the language was to restrictive and to get the job done I had to push the rules to there limites and wirte code which was far from clear. To emphisize my point a restricitve language can not stop you form doing bad things only you can do that; furthere a restrictive language makes some thigs near imposible forceing you to do questionabale things to achive your goals.

      The othere perl saying that this artical left out is "The easy things are easy and the hard things are posible."

      Good code comes form beter programers not restrictive languages.

    7. Re:Natural Languages and P--- Languages by divec · · Score: 2

      > I *want* air traffic controllers to speak in a
      > highly structured, syntactically and lexically
      > limited, and stereotypical fashion!

      While I would agree with this statement about air traffic control, I don't think it holds in other "precision" areas. A mathematician can grapple with concepts which seem hopelessly impenetrable, because of the flexibility that mathematical notation gives him to express his problem in a way which just features the important points, and not the irrelevant information. A good programmer can tackle a complex problem in an elegant and maintainable way if his programming language gives him the same flexibility.

      Of course, many problems are not very complex and/or are being tackled by mediocre programmers. In this case, a language with inflexible notation is more appropriate because using esoteric syntax won't lead to a more elegant or more maintainable program.

      --

      perl -e 'fork||print for split//,"hahahaha"'

  37. Horay! We finally got coverage. Python rocks! by Anonymous Coward · · Score: 2

    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!

    1. Re:Horay! We finally got coverage. Python rocks! by Daniel · · Score: 2

      I prefer...c over lisp by far...because I prefer something thats powerfull but is clean, logically and supporters concise

      You haven't used Lisp, have you?

      Lisp (actually Scheme) code:

      (define a '(1 2 3 4 5 6 7))
      (define f (lambda (x) (lambda (y) (map (lambda (n) (+ n x)) y))))
      (define b ((f 5) a))
      (define c ((f 6) a))

      (b is '(6 7 8 9 10 11 12), c is '(7 8 9 10 11 12 13))

      I tried but failed to write the equivalent C code. However, here's the equivalent of (map (lambda (n) (+ n 1)) lst) in c, except that it modifies the list in place:

      typedef int (*unaryfunc)(int);

      int addone(int x)
      {
      return x+1;
      }

      void map(int *lst, int len, unaryfunc f)
      {
      int i;
      for(i=0; ilen; i++)
      lst[i]=f(lst[i]);
      }

      .
      .
      .
      map(some_lst, some_lst_len, addone);

      Tell me that's more logical and concise?

      Daniel

      --
      Hurry up and jump on the individualist bandwagon!
    2. Re:Horay! We finally got coverage. Python rocks! by Anonymous Coward · · Score: 0

      I'd add one thing--scheme's map works generically. . .C's doesn't

  38. Of Zope, whitespace and style by ajs · · Score: 4
    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?

    1. Re:Of Zope, whitespace and style by jallen02 · · Score: 1

      As crufty sounding as this is going to be! Python IS open source! It doesnt have to be like that . If you really really dislike it and think Python is great, hack it and release the changes.. (id use it to if there were no tab rules. Mostly out of boredom tho and I can pick up most any language in a couple of weeks now but.. bleh. hehe.. Never felt proper motivation to make python not get ticky about indentation and such.. but im sure it is a doable hack. And could cause some interest in Python? Yes no? Use the source at any rate.. :-)

    2. Re:Of Zope, whitespace and style by Rob+Parkhill · · Score: 2

      I love Perl. My first real job in the real world was as a Perl hack, errr, programmer. 4 years ago, if you wanted to do web site work, Perl was the way to go.

      3 years ago, it was still the way to go.

      2 years ago, things like Zope, Cold Fusion and Tango became the way to go.

      Unfortunately, all of these have the same problem... they tie the interface and the logic together into one big mess. Great for throwing together a quick web page, or even a large, complex web site, but horrible for trying to maintain that website as new technologies come along. Why do you think that most major websites throw everything out and start over fresh every 6 months or so?

      I've started playing around with WebObjects now, and I find it to be a lot more friendly to change. The interface is pretty much completely removed from the back end logic (which is then removed from the back-end data to boot), and I think it's great. Heck, I can take some of my current web-based apps, and throw a WAP-based interface on them with almost no effort at all. I can even take that web-based app and make it a stnad-alone Java application, with very little effort.

      Of course, the biggest problem with WebObjects is the cost. Not too many folks can afford the $10,000 entrance fee to get started. The next biggest problem (for me anyhow) is that it doesn't support Perl. Damn. At least I can choose between C, C++, Objective C, and Java, but sometimes you just gotta have Perl.

      --
      "Tomorrow's forecast: a few sprinkles of genius with a chance of doom!" - Stewie Griffin
    3. Re:Of Zope, whitespace and style by deusx · · Score: 2

      Unfortunately, all of these have the same problem... they tie the interface and the logic together into one big mess. Great for throwing together a quick web page, or even a large, complex web site, but horrible for trying to maintain that website as new technologies come along. Why do you think that most major websites throw everything out and start over fresh every 6 months or so?

      This is at the heart of the philosophy behind Iaijutsu-- an open source, object oriented web content and application development framework written in Perl.

      Iaijutsu is similar to Zope in that content and application objects are created and maintained online, through folder trees and online forms. Classes can be created to handle various types of content (ie. GIF, PDF, XML, etc) in different ways. Classes can be created to do specific application tasks (ie. weblogs, discussion boards, parse headlines from RSS xml files)

      However, where Iaijutsu parts with many other systems is a discipline of separation of content, presentation, and logic. Content is composed in object properties. Presentation is done with a very flexible template language. Logic is done either in Perl object classes, or with a hybrid XML/Perl class definition document where properties, methods, templates used, and template accessors are defined with optional perl implementation blocks.

      The separation is a discipline: Content should never be tied to the presentation or logic. Logic should never be contained in the presentation (ie. the application should never be built in the template language!!!). Presentation should never be dictated by the logic.

      In this way, you can target the results of a well designed set of content and application classes to just about any presentation device. (ie. layout & graphic 'themes' or 'skins' for 5.0 web browsers, VoXML for telephone access, WAP for handhelds and phones, etc...) Think XSL and XML.

    4. Re:Of Zope, whitespace and style by Malcontent · · Score: 1

      The best two systems I have seen for separating content from presentation are both based on java.
      Enhydra and Webmacro. You may want to check them out and both are open source.

      --

      War is necrophilia.

    5. Re:Of Zope, whitespace and style by Blake · · Score: 1
      ajs said:
      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?

      We will perhaps eventually be writing only small modules which are identified by name as they are used to build larger ones, so that devices like indentation, rather than delimiters, might become feasible for expressing local structure in the source language.

      -- Donald E. Knuth, "Structured Programming with goto Statements",
      Computing Surveys, Vol 6 No 4, Dec. 1974

      Later,
      Blake.
    6. Re:Of Zope, whitespace and style by ajs · · Score: 2

      You will note that the Knuth quote you dredged up is from 1974....

      That was exactly my point.

  39. No, Perl! No, Python! FOOL! by Duxup · · Score: 2

    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 :-)

  40. TIMTOWTDI -vs- KISS by Jack+William+Bell · · Score: 3

    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...

    Jack

    --
    - -
    Are you an SF Fan? Are you a Tru-Fan?
    1. Re:TIMTOWTDI -vs- KISS by Tony+Tastey · · Score: 1

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

    2. Re:TIMTOWTDI -vs- KISS by Ian+Bicking · · Score: 2
      I can't quite decide what a first order object is... if someone has a good definition, I'd be curious to see it. But, from my intuition of what a first order object is, lots of languages are as powerful in this way as Python.

      In Smalltalk, for instance, collections (of which tuples would only be a subset) are objects on par with anything else -- integers, booleans, etc. Collections and their associated functionality are one of my favorite parts of Smalltalk.

      Though I haven't used them, my impression of APL and J (a successor) are that they allow manipulation of collections -- arrays and matrices -- superior to most languages.

      And any Lisp treats lists as first-class objects, and usually vectors (equivalent to tuples and arrays) as well.

      What's always struck me is how people could stand not to have collections as first-class objects. C with it's horrid pointer arithmetic, Tcl with it's disfunctional string/lists... ugh. Collections of objects are one of the fundamental parts of programming, right along with numbers and bytes. Every language should consider collections as a core part of the language.

      Most languages don't allow the sort of implicit packing and unpacking of tuples that Python does (as in a, b = (1, 2)) -- though there are a number. I don't think there's anything Python does that some other language hasn't done before. Not to criticize Python for it. It's not wrong to learn from the past.

    3. Re:TIMTOWTDI -vs- KISS by Jack+William+Bell · · Score: 2

      I can't quite decide what a first order object is... if someone has a good definition, I'd be curious to see it.

      Hmmm... I don't know if it is a 'definition', but by 'First Order Object' I meant an object, defined as a specfic part of the language grammer, which has a parent of 'Object' and inherits from nothing else. In most languages this also means 'First Class Element' because the language provides specific support for that object while lexing, parsing and executing. Even languages where 'everything is an object' like Python often do this as an optimization and/or to provide support for language features that rely on the first order object. Your own example of implicit packing/unpacking in Python is one example of what I am talking about.

      Although I have programmed in Smalltalk it has been a while, and I am not sure if Smalltalk Collections qualify as above. Plus they are certainly not as flexible and as built into the language definition as are Python Lists. Not that they aren't pretty great (and widely copied) mind you. Even Visual Basic includes Smalltalk style Collections as built-in objects...

      As to APL, is a matrice always a tuple? I guess it depends upon how I can manipulate it. :-/ If it is, then that is one I missed because matrices are definately both first class elements and first order objects in APL.

      Jack

      --
      - -
      Are you an SF Fan? Are you a Tru-Fan?
    4. Re:TIMTOWTDI -vs- KISS by Mr+T · · Score: 2
      Can you post an example of TIMTOWTDI vs. KISS?

      I'm not challenging you so much as I can't think of anything that PERL let's you do that Python prohibits from from.

      I think the way I see the differences between PERL and Python is that Larry has added everything including the kitchen sink to PERL. Guido is very careful about adding new things to python. (part of this may have to do with popularity, PERL is huge and has had far more developers than python has, should python's popularity continue to grow maybe it will become more complex) If there is some programming construct and you want it, it's probably in perl. It has to be compelling enough to be added to python. Python had a fairly complete design idea at the start where PERL was simple and stuff keeps getting thrown in to PERL which adds complexity.

      I think the tersness of PERL code and the obfuscated feel of it (IMO) are a result of the syntax and how so many things have been added to the language, not that it some how liberates you to code things that python doesn't in the name of performance. As has already been said, PERL needs to simmer a little, the best of PERL needs to be sifted out and morphed into something else.

      --
      This is my signature. There are many signatures like it but this one is mine..
    5. Re:TIMTOWTDI -vs- KISS by Oniros · · Score: 1

      > slower execution times

      Not if you have a good compiler. If there are few ways to do a thing, then your compiler can focus on optimizing those and will be "less confused" than if there are 15 ways to actually do the same thing.

      Less line of code != faster execution time. Good compilers will do dead code elimination, common subexpressions optimizations etc.. Also binaries of code optimized for speed tends to be bigger than bins of non-optimized code as you are doing inlining, etc.

      Just my $0.02

      Janus

    6. Re:TIMTOWTDI -vs- KISS by Ian+Bicking · · Score: 2
      Hmmm... I don't know if it is a 'definition', but by 'First Order Object' I meant an object, defined as a specfic part of the language grammer, which has a parent of 'Object' and inherits from nothing else.
      I don't see any particular advantage to having tuples -- or any other class -- directly inheriting from Object. There are a lot of shared functionality between tuples and lists, and even dictionaries.

      The particular class inheritance isn't really a matter of functionality. In Smalltalk Integers don't even inherit directly from Object, nor True or False. I don't think that implies they aren't important to the language.

      Even languages where 'everything is an object' like Python often do this as an optimization and/or to provide support for language features that rely on the first order object.
      Almost every language provides some optimization for tuples. The only exceptions I can think of are Lisp languages, where lists are more important than tuples, and maybe some low-functionality languages like m4 (which hardly count).

      Python does have some syntactic sugar for tuples, and I won't say that's unimportant. But I don't think that makes something quite first-order or not. (doesn't Icon have similar syntactic sugar?)

      In Smalltalk you can do "#(1 2 3)" to make a tuple, or even "{x. y. z}" if you are using Squeak (which is the only Smalltalk I'm really familiar with). For other collections, you can use "#(1 2 3) as: Set" which will inline a Set into the code (as opposed to creating it at runtime). You can even do "{a. b} := #(1 2)" in Squeak, though nobody uses it and for half the releases it's broken.

      In Scheme and other Lisps lists are more important, but their functionality is probably more powerful, since they are used for everything (even the syntax). There's no unpacking for assignment, but then assignment is almost looked down on :-/

      I don't think Python is the most of anything. That's not bad, but it's definately a language of refinement not revolution. The only really novel think, I think, is the indentation.

    7. Re:TIMTOWTDI -vs- KISS by Blackheart · · Score: 1
      I can't quite decide what a first order object is... if someone has a good definition, I'd be curious to see it.

      Here are the generally accepted definitions we use in programming language theory:

      The term you want is "first-class object". A first-class object is one that can be passed to and returned from a function.

      A "first-order object" is anything that is not a function. A first-order function is a function which can be passed or returns a first-order object. A second-order function is a function that can be passed or returns a first-order function. Thus, we say that a language is higher-order if functions of order n can be passed to or returned from functions of order n+1 for any n. A language is first-order if its functions are all first-order.

      Of course, this presupposes that certain properties are satisfied. For example, you can pass to and return functions from functions in C, but C is not considered higher-order. When you return a nested function, you need to be able to retain the local bindings of variables from the enclosing scope, forming what is called a closure. You can't do this in C. The same is also true, incidentally, for Emacs LISP.

      BTW, regarding Python features like significant whitespace (layout) and first-class tuples. Both of these are quite old concepts. I think Landin's language ISWIM, which dates back (correct me if I'm wrong) to the 60's had this. Among modern languages, Haskell also uses layout syntax. In fact, probably many of the best features of Python are features that grew to maturity in the functional language community. For example, Haskell also has first-class tuples and higher-order functions, and of course things like the map function are just part of your daily bread and butter. Incidentally, Haskell is also being used increasingly for Internet scripting and CGI, and it has the advantages over Python that it is strongly typed, lazy and much more efficient; yet there still exist interpreters, etc. for it.

  41. Sorry, DJ by FFFish · · Score: 1

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

    --

    --

    --
    Don't like it? Respond with words, not karma.
  42. Overide tabulation with spaces in your IDE by Krollekop · · Score: 1

    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,
    or
    M-x untabify in the mini-buffer.

  43. I've just start learning Python by Omnifarious · · Score: 1

    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.

    1. Re:I've just start learning Python by spiralx · · Score: 1

      At least, not until I have a line longer than fits on the editor window. :-)

      You can use \ at the end of a line to continue it onto the next line, where you can indent it as you please, so you can do:

      def foo():
      print "hello " \
      "world"
  44. Emacs works great on Python whitespace... by Eric+Green · · Score: 2
    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 :-).

    _E

    --
    Send mail here if you want to reach me.
    1. Re:Emacs works great on Python whitespace... by Edward+Kmett · · Score: 1
      Python mode in emacs can break pretty badly in the presence of triple quotes """, but otherwise I'll agree it works pretty well.

      Regarding the python zealot thing, then what does that say about the existance of Python server pages? PSPs already exist.

      --
      Sanity is a sandbox. I prefer the swings.
  45. Re:How does Python deal with all types of whitespa by Evil+Spammer · · Score: 2
    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!

  46. How holy wars start.... by WhiskeyJack · · Score: 5

    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.

  47. how to comment perl by C.+E.+Sum · · Score: 1

    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, 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?

    --
    -- Have you ever imagined a world with no hypothetical situations?
    1. Re:how to comment perl by PigleT · · Score: 2

      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!)

      --
      ~Tim
      --
      .|` Clouds cross the black moonlight,
      Rushing on down to the circle of the turn
    2. Re:how to comment perl by Lulu+of+the+Lotus-Ea · · Score: 2
      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.

    3. Re:how to comment perl by C.+E.+Sum · · Score: 1
      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 :-)

      --
      -- Have you ever imagined a world with no hypothetical situations?
    4. Re:how to comment perl by gorilla · · Score: 2
      Rob Pike says you should be documenting the data & the algorythms, not the code.

      # wait for job complete would probably fall into Pike's

    5. Re:how to comment perl by jeffcuscutis · · Score: 1

      it's people like you what cause discontent.

      I'm firmly of the "if you can't read it and it's valid perl, that's your sad loss" mentality.

      This has to be the most asinine thing I've heard today. You are obviosly someone lucky enough to write code once and never look at it again and never have to maintain anyone elses code.

      &ltsarcasm&gt I envy you. &lt/sarcasm&gt

    6. Re:how to comment perl by PigleT · · Score: 1

      That's OK. I can cope with people thinking it's assinine...
      Of course, it doesn't stop you being a PHB, though.

      Let's get it straight: if you can't read Perl, which is a fundamental part of this "maintain" crap, then stop trying. No amount of documentation, comments or whatever will help you. The same goes for Python, C, or any other language on the planet. If you can't read it, don't write it. Ability to spew chunks of code, even code with comments, does not make a good hacker; ability to *debug* does.

      --
      ~Tim
      --
      .|` Clouds cross the black moonlight,
      Rushing on down to the circle of the turn
  48. Zope for Perl by chromatic · · Score: 2

    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.

    --

    1. Re:Zope for Perl by deusx · · Score: 2

      For another Zope-like server environment in Perl, named Iaijutsu, see this comment and this website.

    2. Re:Zope for Perl by Gillo · · Score: 1
      Did any of you check squishdot?

      It's the slashdot for Zope and it's up and running in 5 (maybe 4) mins.

  49. Neither... :-) by Alrescha · · Score: 1

    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:

    http://www-4.ibm.com/software/ad/obj-rexx/

    --
    ...bringing you cynical quips since 1998
  50. Library interface between Perl and Python by Ed+Avis · · Score: 3

    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 libperl.so, 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?

    --
    -- Ed Avis ed@membled.com
    1. Re:Library interface between Perl and Python by gorilla · · Score: 2
      Perl's arrays and hashes do nest. There is a reference in there, but you don't really need to care about that unless you want to.

      $a[0]{'this'}[2]="value";

      Creates or modifies an array where the 0th element is a hash, who's 'this' element is an array, who's 2nd element is "value";

      perldoc perllol & perldoc perldsc will give you more than you need to know about nested data structures.

    2. Re:Library interface between Perl and Python by irongull · · Score: 1

      This should be very doable with current software. Check out swig at this link. It provides a framework for interfacing C/C++ with scripting languages like python, perl, guile, etc... I'm not sure if you can interface python and perl using swig, but you could definitely write a C library that could be called from python. This C library could then use perlembed to make the appropriate perl calls. A certain amount of annoying mucking about with internals in C would be necessary, but its probably easier than writing a dozen DBI backends in python. Maybe you could even code some common data type conversions in C and make the interface general enough to handle most modules.

      Of course, you could also just write a small generic server in perl that could communicate with a separate python process using an intermediate data structure implemented in both languages. And I'm sure there are a dozen other more intelligent ways to do it. After all, perl is involved, so TMTOWTDI ;-)

    3. Re:Library interface between Perl and Python by Ed+Avis · · Score: 2

      But you can't just do

      @a = ((1, 2, 3), (4, 5, 6));

      You will end up with a single flat array. Instead you have to take a reference to the arrays you want to nest. For this reason, mapping Python to Perl would be easiest if you map Python lists to Perl list references.

      --
      -- Ed Avis ed@membled.com
    4. Re:Library interface between Perl and Python by gorilla · · Score: 2

      No, you use square brackets instead @a=([1,2,3],[4,5,6]); Comes to the same thing though, just with a difference in the syntax.

    5. Re:Library interface between Perl and Python by Ed+Avis · · Score: 2

      No, it doesn't come to the same thing. Witness:

      @a = ([1, 2, 3], [4, 5, 6]);
      @b = $a[1];

      Doesn't work as you might expect. You have to dereference things manually. You get used to it after a while, but it still grates a little, especially after seeing how easy it is in other languages. (Easy things should be easy!)

      --
      -- Ed Avis ed@membled.com
    6. Re:Library interface between Perl and Python by gorilla · · Score: 2
      It works how I'd expect it to.

      You have a @ on the lhs, and a $ on the right hand side. Unless you're sure that's what you want to do, it's probably a mistake.

    7. Re:Library interface between Perl and Python by Ed+Avis · · Score: 1

      Yes, it works how _I'd_ expect too, but that's because I'm used to Perl's wierdnesses. It's still ultra-bizarre compared to:

      a = [1, 2, [3, 4, 5]];
      b = a[2];

      in some language that doesn't have Perl's legacy of always flattening lists (which seems to be a leftover from before perl5).

      --
      -- Ed Avis ed@membled.com
  51. Zope is Pythons Killer App??? by emfb · · Score: 1

    Anyone who knows anything about Python knows PySol is the true killer app! http://wildsau.idv.uni-linz.ac.at/mfx/pysol.html

    1. Re:Zope is Pythons Killer App??? by Anonymous Coward · · Score: 0

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

  52. A little fairy whispered in my ear by Anonymous Coward · · Score: 0

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

    Yup. She had some big tits too!

  53. Re:How does Python deal with all types of whitespa by dugb · · Score: 1

    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.

  54. OOP? Some stupidities will never die... by jeeves_jv · · Score: 0
    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.

    TTFN

    --

    The more things change, the more they stay insane...

    1. Re:OOP? Some stupidities will never die... by Junta · · Score: 1

      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.

      --
      XML is like violence. If it doesn't solve the problem, use more.
    2. Re:OOP? Some stupidities will never die... by burris · · Score: 1
      Perhaps you don't think much of OOP because you have never used a very good OOP environment. Try Cocoa on Mac OS-X (the Frameworks Formerly Known As OpenStep, Formerly Known as NeXTStep).

      The main reason most people don't think much of OOP is because the most popular OOP environments are based on C++, which is about the worst OOP language ever (if you can even call it OOP).

      Burris

    3. Re:OOP? Some stupidities will never die... by kdart · · Score: 1

      The main reason most people don't think much of OOP is because the most popular OOP environments
      are based on C++, which is about the worst OOP language ever (if you can even call it OOP).

      I concur. My first attempt at learning/converting to OOP was to learn C++. P.U. I never left C. Then, I tried it with Python and could then see the power and utility of OOA/OOD implemented with an OOP language. This is also why I think Python can be, and SHOULD be, a beginner's first language.



      --
      --

      --
      The early bird catches the worm. The worm that sleeps late lives to see another day.
  55. Perl for now, Python later (maybe?) by G27+Radio · · Score: 2

    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.

    numb

    1. Re:Perl for now, Python later (maybe?) by Anonymous Coward · · Score: 0

      It's interesting that you complain Python looks bland. I think that might be one of the big reasons I prefer Python to Perl; I never did all that much shell programming, so all of those $@& all over the place just look wrong. They're somehow noisy, distracting me from the words.

      Then again, I tend to like languages with minimal punctuation, like Scheme, where the only punctuation is parentheses. This is probably another reason that using whitespace to delimit code appeals to me.

      It's probably just a style issue; it's good that both languages are out there, to satisfy people who like both styles.

      Personally, I use python primarily to do numeric work, since there is a nice array-processing module supported by Lawrence Livermore National Labs. I've used both Fortran and Python, and while I've always cursed the whitespace in Fortran, it's never bothered me in Python.

  56. I must be an exception to the norm :) by tuffy · · Score: 2
    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 :)

    --

    Ita erat quando hic adveni.

    1. Re:I must be an exception to the norm :) by scrytch · · Score: 2

      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?

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
    2. Re:I must be an exception to the norm :) by tuffy · · Score: 2
      Emacs delivers a lot in 8 megs, IMHO. The paren matching and syntax colorizing are also biggies for me. So, I stick with it - secure in the knowledge that anyone else can use whatever editor they like.

      As for the whitespace thing, it's really something that's hard to measure objectively. If a language doesn't have the right "feel", it gets uncomfortable to stick with all day long. Perl's little language inconsistancies never felt right to me, and I found Python much more pleasurable to spend in over my typical workday. Other people no doubt feel the opposite. Fortunately there's more than enough room for the Other Scripting Language in the world.

      I like dogs. Walks are good for me :) And its nice to have someone that's happy to see me when I get home.

      --

      Ita erat quando hic adveni.

    3. Re:I must be an exception to the norm :) by pezking · · Score: 1

      fyi, and not to start a flame war, but syntax coloring and paren matching are standard in vim, with 1/8 the memory overhead.

      --
      "They can kill you, but the legalities of eating you are quite a bit dicier" -dfw
  57. Re: Perl/Python faster than Java (Wrong) by rcromwell2 · · Score: 3


    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 caucho.com, 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. http://java.sun.com/products/java-media

    www.jcraft.com demonstrates an *XSERVER*, yes, an X11 display server, ESound server, and true-type font server written in Java.

    At www.komplex.org 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.

  58. Re:Cool! by alangmead · · Score: 1
    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.

  59. Solution by exoduz · · Score: 2

    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.
    #############################################

    --

    --

    # I have no brain
    1. Re:Solution by Scarblac · · Score: 1
      There is a program that *comes with Python* (pindent.py) that looks for things like 'endif' and formats your Python correctly, then deletes them. Maybe it can handle { } too.

      I've never heard of anyone who used it, and I've never seen code that used it. I wonder why.

      And before someones suggests that mixing spaces and tabs should be illegal - if you use the -t option, that will give you a warning. Use -tt if you want an error.

      --
      I believe posters are recognized by their sig. So I made one.
    2. Re:Solution by delysid-x · · Score: 1

      Heh, it wouldn't be too hard to whip up something like that in perl.

      =)

    3. Re:Solution by Abigail-II · · Score: 2
      There is a program that *comes with Python* (pindent.py) that looks for things like 'endif' and formats your Python correctly, then deletes them. Maybe it can handle { } too.

      That defeats the entire purpose of having indentation rules, doesn't it?

      -- Abigail

  60. Re:How does Python deal with all types of whitespa by gorilla · · Score: 3
    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.

  61. Re:How does Python deal with all types of whitespa by scrytch · · Score: 1

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

    Why is my code failing to parse because I do?

    --
    I've finally had it: until slashdot gets article moderation, I am not coming back.
  62. the one true way by raistlinne · · Score: 1

    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?

    --
    They laughed at Einstein. They laughed at the Wright Brothers. But they also laughed at Bozo the Clown. -- C. Sagan
    1. Re:the one true way by Patoski · · Score: 1

      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. Hrmmm... You're assuming that *millons* of ppl will be using a program and that they'll be using the written program alot. What if only a few ppl use a given program or if the program is only used infrequently? If app speed is important you can always imbed Python in areas of C apps that aren't that performance hungry. -Pato

      --
      G. Washington on Government "it is force. Like fire, it is a dangerous servant and a fearful master."
    2. Re:the one true way by Daniel · · Score: 2

      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.

      If you've done any programming, you should know that the first rule of optimization is to optimize where it matters. If all of the CPU-intensive functions of a program are written in a low-level language, scripting languages can be incredibly helpful as the logical 'glue' to bind the low-level bits together. This is not a CPU-intensive task, generally, and makes the program more extensible and (generally) easier to write at the high level.
      For an example of this, compare Sawmill, which wraps low-level C window management functions in Lisp and encodes all higher-level operations in Lisp routines, with Enlightenment, written entirely in the ever-so-efficient language of C.
      How do they compare? Sawmill is faster, stabler, has a smaller memory footprint, and is infinitely more extensible than Enlightenment. And to pick a more fair opponent, it doesn't compare shabbily at all to some of the more 'lightweight' window managers such as fvwm or icewm; it's slightly less efficient, but not nearly as much as Enlightenment.

      As long as the lowest level of stuff, where (presumably) the majority of CPU time is spent, is done efficiently, efficient design is far more important than highly optimized machine code.

      Daniel

      --
      Hurry up and jump on the individualist bandwagon!
  63. Block structure by josu · · Score: 1
    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.

  64. new religion in programming world. by bholmberg · · Score: 2
    There is a new open sourced programming language that is about to run rampid through the western continents. It's called Ruby, and has successfully "seduced" Python and Perl users in Japan.

    I just saw this article over @ IBM's developerWorks, and I think It's going to change the "market saturation" of perl & maybe eliminate python.

    I have only tinkered around with this a little, and I'm impressed so far. The language was developed to be object oriented, which eliminates the "added on" feel of OO programming in Perl and Python.

    For those who aren't about to wade throught the 12 whopping pages on this amazing new japanese phenomenon (kind of like those electric pets a while back; gigapets I think they were called), I've included the most basic description based on exceprts from the article below. (you can get it here by the way.


    Ruby is an absolutely pure object-oriented scripting language written in C and designed with Perl and Python capabilities in mind.

    Ruby has been gaining popularity over the past few years, especially in Japan, where it was born and conceived. Its features, like Perl's, are designed to process text files and complete systems management tasks. Ruby is highly portable and easily customized, but primarily draws users because of its purity and readability. In particular, CGI code scripters are increasingly frustrated with Perl's occasionally enigmatic code and Python's inelegant and difficult syntax that requires "too much typing." Neither Python nor Perl were designed as object-oriented languages. Consequently, the OO features often feel "added on" and are not fully integrated into the language core, making for cryptic code.

    Based on the syntax of Eiffel and Ada, the power of C, the functions of Python, and the diversity of Perl, Ruby really is an attempt to combine the best of everything.
    1. Re:new religion in programming world. by AMK · · Score: 2
      One of the nice things about the Python community is that it contains a lot of people who just like programming languages; you often see people proposing to add some cool feature from Icon or Haskell to the language. (The answer's usually "no", but that's another story, and we get some interesting discussions in the meantime.) The author of Ruby has shown up on comp.lang.python and participated in some low-flame-content threads. Ruby's certainly interesting, but talk of it killing off Python is rather optimistic.

      For example, as pointed out in the c.l.p thread, the DeveloperWorks article says "For example, Perl's use of "@", "$", and "%" often causes considerable grief and confusion." The root problem the article's talking about is more the presence of explicit references, not the arbitrary syntax characters, but anyway... Later on, the article explains some of Ruby's syntax: ""var" specifies a local variable, "@var" specifies an instance variable, "$var" specifies a global variable." Hmm...

      I remember postings years ago where people argued that Java would probably kill off Python, though Perl would survive. Thanks to JPython, Java now represents a growth area for Python, and one where Perl doesn't yet have anything comparable, so things turned out just the opposite. Neither Perl nor Python have killed off Tcl. Don't go talking about Ruby replacing other languages, because it certainly won't, and because such hype leads to bitter disappointment later. (See Java, again, for an example of that.)

    2. Re:new religion in programming world. by Fizgig · · Score: 1

      I've been checking out Ruby lately, and it's pretty interesting (how come there are no RPMs for this thing? I had to make my own!). But I'm a little turned off by some of the arguments they put forth for the language. Python is really object-oriented. Everything is an object. It could be more OO (unavoidable data hiding, no procedures, etc.), but they make it sound like Python is non-OO or that it was an afterthought, which is hardly the case.

      My only other problem is that the stuff looks like Perl. The biggest complaint about Python has got to be the blocking-by-whitespace, but at least for me (and I'm sure lots of other people) once you get over that you love it. I try to write C like that. Unfortunately, leaving out braces and semicolons tends to make C not work too well :)

      Ruby may try to remove some of the more, um, bad "other ways to do it" from Perl, which is nice, but it doesn't really make it any more readable at a glance (not as important as being able to read it while staring at it, probably, but still very useful). Python and Eiffel get my praise for being the two languages whose programs I could read before I actually knew how to do anything in the language. They just make sense. I don't think everything should have to be like that, though. Some freedom is good, but having a little guidance is also desirable. Maybe after I've learned Ruby more I'll be able to better judge it. Anybody have comments on how it fares there? Now I just have to figure out how to get a newsreader to display Japanese newsgroups legibly. . .

  65. Interesting things about Python and Java by burris · · Score: 3
    I've been using python for about 5 years now and I have converted some extremely zealous Perl addicts. There are many interesting things about Python that people don't know about.

    There are several different implementations of Python, but the most notable are CPython (Original Python) and JPython. JPython is an implementation of Python in 100% pure Java. Python scripts run anywhere there is a JVM (though you need the JPython jar and probably the Python class library). Furthermore you get complete access to Java from within Python. You can instantate and send messages to any Java class. You can even subclass Java classes in Python. You can use the Python interactive mode to interactively manipulate Java classes. It's way cool! In my opinion, it is the best way to deal with Java. Python becomes a higher level langauge on top of Java.

    Anyone who is forced to use Java (which is becoming more and more politically correct every day) would be wise to check out JPython.

    Many people complain about Python's use of relative indentation but those people typically don't use python. It really is a complete non-issue for people that use Python. Let's face it, cutting and pasting code when using an Object Oriented language is Bad Form.

    Note that it is indeed possible to defeat the indentation if necessary. Check out this implementation of a CBC (Cipher Block Chaining) mode Karn cipher in Python (using MD5 for the hash function). The key and IV are crunched with MD5 before usage, so they can be of arbitrary length and density.

    Usage: karn -e "key" "initialization-vector" | karn -d "key" "initialization-vector"

    from md5 import *;from sys import *;from string import *;M=md5;il=ir=M(argv[3]\ ).digest();ki=M(argv[2]).digest();K,k=ki[:8],ki[8: ];p=stdin.read(32);c={'-e':'\ l=x(l,il);r=x(r,ir);R=x(M(l+K).digest(),r);L=x(M(R +k).digest(),l);il=L;ir=R','\ -d':'L=x(M(r+k).digest(),l);R=x(M(L+K).digest(),r) ;L=x(L,il);R=x(R,ir);ir=r;il\
    =l'};main="def x(a,b):return joinfields(map(lambda m,n:chr(m^n),map(lambda m:o\
    rd(m),a),map(lambda m:ord(m),b)),'');\nwhile(p):p=ljust(p,32);l,r=p[:1 6],p[16:\ ];exec(c[argv[1]]);stdout.write(L+R);p=stdin.read( 32)";exec(main)

    1. Re:Interesting things about Python and Java by Abigail-II · · Score: 2
      Let's face it, cutting and pasting code when using an Object Oriented language is Bad Form.

      So, you never cut-and-paste after you typed python without arguments on the command line?

      -- Abigail

  66. try that with a Python.... by jjohn · · Score: 1

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

    Try giving a female the python? Would I have to buy her dinner first?

    1. Re:try that with a Python.... by Wench · · Score: 1

      WaaaH! I WANNA PYTHON!

      Sod the boring jewelry, give me something animate and interesting that will scare Mormons and eat cockroaches...

      --
      No matter how cynical you become, it's never enough to keep up.
    2. Re:try that with a Python.... by h2odragon · · Score: 1

      nono, that's back asswards, it's EAT the mormons....

  67. Udell needs to get out more by Anonymous Coward · · Score: 0

    Udell's perspective seems rather limited. For example: "power tools like Perl's amazing map function, which applies a function to every element of a list." Simply amazing? This sort of thing is SOP in Lisp and other functional languages. And Scheme, for example, is available as a Unix scripting language in scsh and guile.

    1. Re:Udell needs to get out more by Anonymous Coward · · Score: 0

      it's especially hilarious since udell claims he knew lisp among other languages before getting to perl, and later its wonderful and revolutionary map command.

  68. Nice one by Anonymous Coward · · Score: 0

    You're trolling, aren't you? Nobody could say so many wrong things and not be trolling.

    I especially like, "C++ is single-handedly responsible for the entire Windows community." comment. It was almost as goofy as your "most Linux developers use C, so OOP is a failure" argument.

    I'll have to work hard to match your trolling abilities, my friend. In the meantime, I'll enjoy watching the angry ASCII that will flow as result of your post. Thanks!

    --What if I really DON'T want to be on index.pl right now?

  69. There is another culture: Ruby by SIGFPE · · Score: 1

    There is an alternative to both Perl and Python. Ruby. There is a description at IBM It's a real object oriented scripting language that owes a lot to Smalltalk. It handles strings and regexps as easily as Perl and yet it is a real programming language with a simple (compared to Perl) grammar. Check it out. Look out for the iterator objects which allow you to define new control flow structures easily and the way *everything* is treated uniformly as an object - including blocks of code.

    --
    -- SIGFPE
  70. Re:How does Python deal with all types of whitespa by Cuthalion · · Score: 2

    I've several times run into problems like:

    if (case1)
    if (case2)
    print "case2";
    else
    print "Neither case1 nor case 2";

    There the indentation is rather misleading, in a non-obvious way. (The else gets grouped with the inner if, not the outer)

    It's pretty frustrating spending a long time tracking down a "That's not what I meant!" bug, just because it reads just like what you meant. (in C/C++ and many derived languages {&,&&} and {=,==} are good at helping this kind of thing along)

    For the record, I programme in neither Perl nor Python, so I'm relatively "unbiased". :)

    --
    Trees can't go dancing
    So do them a big favor
    Pretend dancing stinks!
  71. Of Killer Apps by miniwookie · · Score: 1

    The article seems to conclude that Python will explode because it has a "killer app" in the Zope application server and that perl lacks such a killer app. I don't think this is correct. mod_perl (the Apache perl module) is certainly an equivalent.

  72. Re:How does Python deal with all types of whitespa by fusiongyro · · Score: 3

    as long as you are consistent about the amount of whitespace in a given block, it doesn't matter if you use a tab, three spaces, or any combination. Python cares if you are consistent about it within the block. it does not have to be a tab.

    for example, run "python" and type these in:


    def myFunction():
    print "two spaces"

    def yourFunction():
    print "eight spaces"


    no problem. just use the same spaces in a given block.

    Daniel

  73. High Performance Scripting by Anonymous Coward · · Score: 0
    Learn Forth. You can have your cake and eat it too! Forth code can be run as scripts, but executes nearly as fast as C code. It is highly extensible and allows object oriented programming.

    Forth .org's website

    Bigforth (Has its own GUI)

  74. Where the heck's the flamewar? by Get+Behind+the+Mule · · Score: 2

    What's going on around here? A Perl vs. Python thread on Slashdot, and instead of a flamewar, there's a reasonable and even pleasant discussion going on? (At least when I browse at +2.) What's the world coming to?

    Well, all right then, I'll try to write a level-headed post as well. This article is very well done, a welcome departure from the usual vitriol. I strongly believe that not only this particular religious conflict, but also many of the other ones such as Mac vs. Windows and Linux vs. BSD and vi vs. emacs, are based much more in habit than in reason. We like what we've learned to use well; everything else seems unintuitive and vaguley threatening.

    I myself am very much steeped in Perl programming and simply have not yet gotten around to learning Python, just a lot of other people. I've had a few episodes in the past when I've been much more defensive about Perl than was appropriate. If someone else wants to get all bent out of shape about a programming language, then they have a problem I don't need to compound. See how hard I'm working on bettering myself? :-)

  75. Python in the real world by Anonymous Coward · · Score: 3

    I didn't know Python.

    At my old job, I was told to learn it because we were going to use it as our scripting language for a text animation system we were working on. At the time it wasn't a priority, and my internship ended before I got around to it.

    I know Perl, and I always cringe whenever I have to code in it. It's something about all the excess punctuation that is required to do anything.. It's a hemorrhoid to read anyone else's code.. I think Perl code in itself is a good fingerprint of the psyche of the programmer. You can see little hints of anarchy/anal retentiveness in it. WTF - why can't the code be cleaner? Why can't it represent the true nature of what the programmer is trying to get across?

    And then I started working for this VFX company in Austin, TX (I'm an anonymous coward, remember?) We were in desperate need of a robust distributed work queue for rendering, compositing, compiling..etc. I still had the Python books, so I decided to check it out, making this my little project that I would use Python for.

    In one week I knew everything about the language there was to know. Easy - direct - clean - beautiful. By the second week I was writing C modules to interface with NT and SGI (the two architectures we use) system libraries. Serious cake.. The OOP structure of Python is very free and easy to understand and code.

    ...

    Now that the project is done, I can't imagine using Perl, or any other language to do something like this.

    Some of the joys I found while learning Python and coding this thing were (no I'm not into abusing buzzwords) ease in RPC communication and data marshalling, thread control, bidirectional pipes, code-reuse, architecture independence, exception handling, and the easy ability of going back into what I wrote and being able to read my own code - not to mention a great debugging environment.

    It's sort of like a really clean C++ with the convenience of Perl.

    I would HIGHLY recommend Python as being something you need to learn and start using! I mean, Perl is good for hacking stuff together because you know how to do it in Perl. Even Bash is good for that.. But Python really gives you a good feeling that you are architecting something that is made to work, made to last, and made to be maintainable. And Python is extremely good for quick Perl-ish hack jobs.

    Maybe Perl (in reference to an above post) is for artists, but I think Python is for designers. Know which one you are, before you do anything else.

    Sean

    1. Re:Python in the real world by ajs · · Score: 2

      Some of the joys I found while learning Python and coding this thing were (no I'm not into abusing buzzwords) ease in RPC communication and data marshalling, thread control, bidirectional pipes, code-reuse, architecture independence, exception handling, and the easy ability of going back into what I wrote and being able to read my own code - not to mention a great debugging environment.

      Ok, cool. What part of this is Perl lacking?

      One thought: if you have trouble reading your own code in *any* language (even assembly) I suggest you start commenting your code and being a little bit more verbose. People who want to maintain your code will thank you for it.

    2. Re:Python in the real world by Baki · · Score: 1

      We're talking about reading someone else's code.

      Also 'self-documenting' code is even better than lots of comments.

      btw. I used Perl a lot, Python never. Out of habit I'll take Perl but I'd really like to learn Python. Large programs in Perl, even if documented, tend to get unmaintainable. Yes, with lots of documentation you can even make assembly understandable, but code that is clear and speaks for itself always is to be preferred.

  76. Re: Perl/Python faster than Java (Wrong) by orcrist · · Score: 2

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

    No. They have a poorly done benchmark comparing to Apache::Registry which is effectively just a hack to get legacy CGI scripts to work under mod_perl. For an explanation as well as more accurate benchmarks check out this thread in the mod_perl mailing list archive

    For the lazy, here are some of the relevant results:

    > These tests used httperf with persistent connections, making either
    > 1000 or 100 requests per connection, depending on the test. The results
    > on "hello" are astounding:
    > Test: "hello" -- displays "Hello, World"
    > Size: 450 bytes
    > httperf: 40 concurrent connections, 1000 requests/connection
    > Results:
    > mod_perl+Apache: 1600 req/sec
    > Resin+Apache: 500 req/sec
    > Resin httpd: 4600 req/sec
    >
    > Test: "bighello" -- lots of HTML + "Hello World"
    > Size: 23888 bytes
    > httperf: 40 concurrent connections, 100 requests/connection
    > Results:
    > mod_perl+Apache: 480 req/sec
    > Resin+Apache: 300 req/sec
    > Resin httpd: 280 req/sec
    >
    > Test: "database" -- query: "select NAME from DIVISION", returns 11
    > rows
    > Size: 460 bytes
    > httperf: 40 concurrent connections, 100 requests/connection
    > Results:
    > mod_perl+Apache: 570 req/sec
    > Resin+Apache: 300 req/sec
    > Resin httpd: 450 req/sec

    > I also tested the "file.jsp", which I renamed "fortune" in the perl
    > tests. With http_load, the results again show mod_perl ahead:
    > Resin:
    > 1584 fetches, 10 max parallel, 489610 bytes, in 10 seconds
    > 309.097 mean bytes/connection
    > 158.4 fetches/sec, 48961 bytes/sec
    >
    > mod_perl:
    > 6190 fetches, 10 max parallel, 1.98814e+06 bytes, in 10 seconds
    > 321.186 mean bytes/connection
    > 619 fetches/sec, 198814 bytes/sec

    Of course, as with all benchmarks, these should be taken with a grain of salt; I'm just pointing out that for the benchmarks on the caucho homepage you'd better keep the salt shaker handy ;-)

    Chris

    --
    San Francisco values: compassion, tolerance, respect, intelligence
  77. Java still broken after years of hype by rambone · · Score: 1
    Even too this day the core collection classes are oversyncrhonized (and most programmers don't even know what synchronization is)...the GUI stuff is still shoddy...no parametric polymorphism (STILL)...WORA (write-once-run-anywhere) is a complete joke...the list goes on.

    The amusing thing about Java is how broken the language and implementation are to this day. Java2 addresses some issues, but Java is at least two years or more away from being as useful for big and small problems as its competition.

    If Sun wasn't pouring millions of dollars into hyping Java, it wouldn't even be an issue - Java would have vanished long ago. Only Sun's PR budget keeps it alive now...and let me add that even this is changing - Java is falling off the radar of most developers who are sick of waiting it to become a half decent development tool.

    1. Re:Java still broken after years of hype by Tallis · · Score: 1
      I am always amazed when I read articles that disparage Java as hype. I find it even more amusing when you compare development in Java to the widely accepted alternatives: C and C++. Maybe it's just me, but these languages have very serious fundamental problems that are quite a bit worse than the problems you find developing in Java today. Examples abound in Ian Joyner's criticism of C++.

      Why disparage a widely available development platform (Java) that is better than any other widely available platform available to us? Perhaps we should all be working to improve Java rather than tearing it down. It may be our best hope to improve programming in this decade. Other better languages may someday replace it. But why deny yourself its improvements today?

    2. Re:Java still broken after years of hype by rcromwell2 · · Score: 2

      Well, I have developed pure-java versions of SMTP, POP, IMAP, and a Mailstore object DB, and developed them on Linux, but deployed them on NT and Solaris without any code changes or recompiles. WORA seems to work for me. I have also deployed Java GUI document management systems that worked fine on NT and Mac's without changes and without bugs. Sure, there are VM bugs, but WORA by and large works. Especially for Type-4 JDBC drivers which are marvelous.

      Synchronization in the collection classes only has a minor impact on the modern JIT's. Why don't *YOU* try writing some simply benchmarks to test synchronization in Java, or go look up the old Dr. Dobb's articles. In both the Symantec JIT and Hotspot VM, a non-contended monitor has neglible impact. Back when I was a HotSpot beta tester, I run benchmarks on the interpreter vs the classic (symantec) JIT, vs HotSpot, and tests showed neglible differences between synchronized and non-sychronized methods. For pure-interpretative, on the old JDK1.1 VM's, sure, sync'ed methods could have a perform hit of up to 50 times slower.

      Even so, the Java2 collection classes solve the "problem", and they are available for JDK1.1 as standard extensions, plus you could always use ObjectSpace's JGL.

      Parametric Polymorphism is being worked on, because they are trying to it right, not simply copy C++'s bloated mess and poor implementation (cause by a beyond-dumb linker requirement)

      Contrary to your FUD however, Java is not falling off the radar. Recent studies in InfoWeek reveal that the number of Java programmers just edged out C++ programmers for the first time.

    3. Re:Java still broken after years of hype by rambone · · Score: 1
      Perhaps we should all be working to improve Java rather than tearing it down.

      Sun's crappy licensing has scared off anyone who knows how to read.

      Contrary to all the hype and BS, Java is closed and Sun knows it.

  78. Please learn how a JVM works by rambone · · Score: 1
    The fact remains that Python/Perl are interpreted, and Java, while being bytecoded, is compiled on the fly to native instructions.

    Java code is compiled to bytecode, not native code.

    Perl is also compiled to a bytecode format before execution.

    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).

    Which is almost every perl program. Perl has everything and the kitchen sink built in....most userland programs are executing compiled functions...this is why perl typically executes much faster than Java.

  79. pronounciation by willhelm · · Score: 1

    I think it's important as to what language you speak. If you naturally speak in a very gutteral language, Klingon for instance, then Perl is definitely your choice language. Lots of gutteral punctuation stuff in there for many endless hours of happy oration. Perl is also the choice language for code obfuscation contests and plain old hard-core showing off with Perl one-liners that hack and slash text files into important bits, save it to a database after consulting an LDAP directory tree, heat up a burrito in the microwave two offices down, and print out a banner message pronouncing your coolness in hex on your friend's terminal.

    And Python is great for writing stuff that you want to be able to read later on without endless comments and your secret decoder ring.

    /will

  80. Re:Cool! by gorilla · · Score: 2
    I thought byte killed itself when it chock full of adverts.

    When you open a magazine, and the first page of content is on page 200, you're not going to read pages 1-199. All those advertisers soon realized that, and stopped wasting their money.

  81. Your Comment Helps by Anonymous Coward · · Score: 1

    I'm working in education and have been gathering feedback for awhile on which programming language to introduce to middle school students. I lean towards python only because it *is* more readable and clean looking, which naturally makes it less time consuming for me to spot errors in student code. And with student friendly internet apps like Alice (alice.org), Python lets kids create interactive worlds as they pick up OO principles. Speed is important too. Since Python is definitely syntax friendly-- I think it should attract students who might be otherwise put off by difficult PERL code. Not that Perl is bad for kids-- just difficult to digest at first. Now, if we could only get everybody together in pushing a *free* standard programming language at Middle/High Schools in the US, we wouldn't need to dump so much money in tech education.

    1. Re:Your Comment Helps by Pelerin · · Score: 1
      I'm working in education and have been gathering feedback for awhile on which programming language to introduce to middle school students.
      Guido van Rossum, Python's author, has a project called
      Computer Programming for Everybody which you may want to keep an eye on (although it's still in its early stages).
  82. Link to interview and comments on OO snake oil by rambone · · Score: 1
    i have linked the interview here

    There is no doubt that OO is the biggest bit of snake oil to come out of the programming "gurus" in ages. Think about it folks, OO has been pushed down our throats in one form or another for over twenty years. If it hasn't worked by now, it ain't working.

    Work on any sufficiently large real project and you'll find it easier said than done to decompose your project into a whiz-bang hierarchy that actually works...and once it does, look out for the bloat on your object files, and the horror that ensues when you realize you made a mistake somewhere back there in a base class and you have to tear the thing to shreds.

  83. Re:Haven't we messed with text files long enough? by Ricdude · · Score: 1

    I admit it has advantages for parsing by humans. However, I can't help but wonder why we (programmers) have to spend so much time messing with text files. The simple act of editing a text file introduces several issues to your development process, most notably:

    - does everyone's editors use tabs or spaces?
    - are tabs 8 characters? or 5? or 4? or 3?
    - are end-of-line markers LF? or CRLF?
    - are filesystems case sensitive? insensitive?
    - c/c++ coding style consistency? yeah, right.

    When we started porting The Product (tm) to WinNT from a unix codebase, each of these issues caused
    problems in some way. The IRIX compiler won't accept an end-of-line that's a CRLF, as the CR kills the compiler. Case insensitive filesystems are one more thing I could cheerfully throttle Uncle Bill for. At any rate, these are matters that programmers shouldn't have to mess with.
    It beats the hell out of punching cards, but it's still a waste of our time.

    With the advent of UML, there is now a rich, common graphical language for exchange of program design (at least for OO languages). My dream programming environment consists of manipulating graphical representations of the code in UML, perhaps flow charts for individual methods, and clicking the Generate Code button. The backend would handle all the trivialities of generating a workable code base, in my choice of implementation language(s). Generate IDL for interprocess method invokations as required by your model. Much the same as modelling a 3D environment, and clicking the Render button. Render the 3D model as png, jpeg, gif, whatever. Same with the code. "Render" the code in C/C++, Tcl, Perl, Python, Eiffel, whatever. Rational Rose is a good step, but that particular program's interface is far too complex for human usage.

    There are projects out there attempting to specify XML standards for program design. Support them. Support the automated toolsets to generate them. Then start using them, avoid sweating the minutia and be even more productive.

    --
    How's my programming? Call 1-800-DEV-NULL
  84. Cosing Standards by Samrobb · · Score: 2

    Just about every set of coding standards that I've ever seen (including the GNU standards) specify not only brace style, but indentation (2,4,8 spaces) and how that indentation should be done (usually, all spaces, or "you must convert tabs to spaces", etc.)

    <RANT>

    So what's the big deal? You're either (a) doing it anyways, or (b) your code is so freaking sloppy that any amount of structure is anathema to you.

    "It confuses CVS" is about the lamest excuse I've ever heard of. Since when do you base your choice of language around which source code control system you use? Sheesh.

    </RANT>

    --
    "Great men are not always wise: neither do the aged understand judgement." Job 32:9
  85. Killer App & TMTOWTDI by Get+Behind+the+Mule · · Score: 3

    Having said in an earlier post that I like the article, here's two things I disagree with.

    For one thing, the claim about a "Killer App" is not terribly persuasive. Perl may not be able to point to an application that is as impressive as Zope, but there is a multitude of Perl software components that have proven themselves as killers -- such as the CGI, DBI and LWP modules and Apache's mod_perl, to name just as a few. A great deal of software running on the Internet constitutes Perl's "killer".

    More importantly, I don't at all believe in a distinction between Perl and Python, or for that matter any other language, concerning TMTOWTDI -- as if Python's motto is "There's only one way to do it", or TOOWTDI (pronounced "tooty").

    People act as if TMTOWTDI is a special feature of Perl, but I don't buy it. TMTOWTDI is an essential truth about the way computers work, regardless of any programming language. Show me any problem, and I'll show you more than one substantially different Way To Do It, using any language.

    TMTOWTDI is often misunderstood as a free-for-all, a ticket to do whatever you want. Not so. The motto should always be continued with, "... But Some Ways Are Sometimes Better Than Others". Some solutions to a problem will run very fast. Others won't run as fast, but will use less memory or I/O. Yet other Ways To Do It lend themselves to being written in more easily maintainable code. If you read the Camel and other Perl docs carefully, you'll notice that the authors are always at pains to make these differences clear.

    Suppose your program needs the value of a complex function. You could compute the function on the fly, which may take some time but saves space. Or you may pre-compute it for a large number of values, which will take up a lot more space but will run much more quickly. Your choice of a solution will probably not be influenced at all by the programming language you've chosen to use, but rather by the resources you have available.

    I don't know Python, but I flat-out disbelieve that it allows only one way to solve any particular problem.

  86. Re:How does Python deal with all types of whitespa by Anonymous+Shepherd · · Score: 2

    ?
    Because tab-whitespace is different than space-whitespace?

    Again, unless tab = 8 spaces and you always uses 8 space indents...



    -AS

    --

    -AS
    *Pikachu*
  87. First-order tuples by cpeikert · · Score: 1

    Any dialect of LISP (e.g., Scheme) will treat tuples (OK, pairs) as first-class objects. Even better, programs themselves are essentially complex structures built from pairs. This is all a consequence of LISP's incredibly simply syntax (even simpler than Python, I'm sure). That makes LISP a great language for writing programs that manipulate programs (evaluators, compilers, etc.). I've seen simple compilers implemented in hundreds (not tens of thousands) of lines of LISP code. If you like Python's ability to built complex structures from basic pieces, you'll really like LISP.

  88. Indentation problem solved for emacs haters by GerritHoll · · Score: 2

    Hi, for those people who want auto-indent-like stuff but don't like emacs: Python comes with an excellent IDE, called Idle. It has an editor with auto-indent, backspace drops an indentation level, many syntax color highlighting, etc. I can imagine you hate emacs - use Idle instead! regards, Gerrit.

    1. Re:Indentation problem solved for emacs haters by kdart · · Score: 1

      VIM is also a good with Python. VIM is a vi clone, and you already have it on your Linux box. 8-)


      --

      --

      --
      The early bird catches the worm. The worm that sleeps late lives to see another day.
  89. Re:ML and Tuples by Jack+William+Bell · · Score: 1

    Well, this is getting off-topic but I had to reply...

    Not knowing much about ML, I looked it up online. It is amazing how many websites about ML seem to assume you already know what it is! Anyway, from what I can tell ML falls into the subset of languages known as "Functional Languages" which are really a form of "Declarative Languages" -- and I already mentioned "SQL and other declarative languages" in my original post. In other words you still haven't told me about a "Procedural Language" (OOP or non-OOP), other than Python, that supports Tuples as first order constructs.

    Don't take this to mean that I am trying to refute you, I could have completely misunderstood what I read.

    Jack

    P.S. I have never liked Declarative Languages because they expect me to describe what I want the computer to do and then let the computer figure out how to do it. In my experience this always leads to convoluted code (and lots of lost time) as I attempt to get the computer to do it slightly differently than it thinks I asked for. I excuse this in SQL because I have nothing better to replace it with, but business rules tend to be best implemented in a procedural style...

    --
    - -
    Are you an SF Fan? Are you a Tru-Fan?
  90. Python: Language of Mental/Moral Degenerates by Anonymous Coward · · Score: 0


    Any fool can see that Python one of the Lesser Languages of the world, along with the inferior and obsolete likes of C, C++, LISP, Fortran, and all other non-Perl languages. Python is fit only for the use of babbling imbeciles who prefer so-called "elegance" to labyrinthine complexity, those helpless morons who believe that a programming language is a mere tool rather than a way of life.

    Well, for them a programming language may well be a mere tool. This is why they will soon be exterminated. They have fallen behind in the evolutionary sweepstakes, and are no longer worth the oxygen they consume. They will all be killed, and Perl will have finally earned its rightful place as the Only Language.

    All communication will take place exclusively in Perl. You will propose marraige in Perl. If your beloved cannot understand the question, that's for the best: People like that must not be permitted to breed. You will order your meals in restaurants in Perl. If you can't make yourself understood, you will justly be ejected, and you will starve.

    There Is More Than One Way To Do It! This will be the battle cry of the New Human Race. All those mental and moral degenerates who insist on using inferior languages will be forced do things in multiple ways, and to use the One True Language to do it. If they cannot learn, they will be terminated.

    The human race will be purified and improved -- and there is ONLY ONE way to do THAT.

  91. use your imagination... by prok · · Score: 1

    Is it really that hard to figure out what a girl might like about a python? (or 'python' in this case)

    Get you mind in the gutter soldier!

  92. Java is verbose by Camel+Pilot · · Score: 1

    Java is simply too verbose. It takes 50 lines of java to do what Perl does in 10 lines. This is 10 lines of well written (not intentional compacted or expanded) code. Not sure about python, but I suspect that python is probably closer to Perl in this respect.

    1. Re:Java is verbose by rcromwell2 · · Score: 2


      So? The same goes for C and C++. That's because Perl has built-in syntactic sugar for Hashtable and Array manipulation, plus variable interpolation, so one can avoid concatenation and printf() style APIs.

      This hardly makes it the language of choice. It makes it great for quickly prototyping something. But when it comes time to write the final implementation, why should I care about syntactic sugar vs readability and documentation. Verbosity has its benefits too.

      Perl's lack of named parameters for instance, makes it exceeding difficult to write something like JavaDoc or LXR.

    2. Re:Java is verbose by rambone · · Score: 1
      So? The same goes for C and C++.

      Yes, but at least you get blazing performance in exchange for all the tedious typing. Java is all the pain, none of the gain.

      That's because Perl has built-in syntactic sugar for Hashtable and Array manipulation......This hardly makes it the language of choice.

      Not unless you value your time.

      But when it comes time to write the final implementation, why should I care about syntactic sugar vs readability and documentation

      This is the type of programmer Sun is aiming at - mediocore coders who rely on utterly verbose syntax to keep them a good arm's length away from ever having to THINK.

      By the way, perldocs offer great inlined documentation, and perl has a convenient comment delimiter ('#') like any other language...what you do with it is up to you.

      Perl's lack of named parameters

      ...is what allows perl to do freaky-friday dynamic programming tricks that Java programmers can't conceive of, because they're stuck in the mentality of making a better C++. Rewriting code on the fly, interpreting and modifying packages based on run-time events...creating and using subroutines at will during execution...do Java programmers even understand the power of these techniques???

    3. Re:Java is verbose by rcromwell2 · · Score: 2

      Rambone, you are either a troll, or 12 years old, or both. Either way, I'm done arguing with you, even if I've written 1000 times more Perl code than you. Please, point me to your code, and I'll put up mine.

      When you write something more significant than a 500 line program, and have to work with a team of people who must understand and re-use your code, then let's talk about "valuing your time"

      What does terseness of syntax have to do with THINKing? Except maybe in Obsfucated Perl contests, I don't see what value it has. Why do you use Intercal or ALGOLthen?

      Perl's lack of named parameters have nothing to do with dynamic programming, and if you weren't 12 years old, you'd realize people were doing "dynamic" programming with Lisp a long time ago. Lisp can dynamically create and bind new subroutines at runtime *with* named parameters. So can Self, Smalltalk, and Objective-C I believe.

      Java1.3 can also do this with proxy classes, and with Java1.0-1.2, it can be done with a custom class loader.

      I have little need for Perl's autoloader and symbol table tricks, nor self-modifying or dynamically generated code. Such tricks are hacks to prevent refactoring code, and end up being unmaintainable over the long term.

      I await you posting a significant Perl module that you have developed using these tricks.

    4. Re:Java is verbose by rambone · · Score: 1
      I await you posting a significant Perl module that you have developed using these tricks.

      Sorry, all my perl is owned by the one of the world's busiest (as in top five) web sites. I have at least 50k lines of perl checked into this company's source repository.

      Rambone, you are either a troll, or 12 years old, or both. Either way, I'm done arguing with you

      Funny, each time you threaten us with your impending departure, you rattle off a post that would do Tolsty proud.

    5. Re:Java is verbose by rcromwell2 · · Score: 2

      So you've never written anything in perl other than some web scripts. Yawn. Care to mention what the application is or which "top five" site it is? How much of those "50K" lines amounts to << EOF, sections.

    6. Re:Java is verbose by rambone · · Score: 1
      So you've never written anything in perl other than some web scripts

      What else is there?

      Most top software folks at big software houses will tell you that .exe's are dead...if you aren't programming for the web, what are you doing?

      People programming at top web sites are being compensated better than any other programmers in the industry (think seven digits). Chew on that before you knock it.

    7. Re:Java is verbose by Camel+Pilot · · Score: 1

      What does terseness of syntax have to do with THINKing?

      Plenty. Expressing a concept clearly in less words, paragraphs, or sentences encourages better and faster comprehension. That is why tech writing classes always preach keeping sentences down to 20 words or less. For example it is faster (and easier) to understand

      @sub_array = grep /$pattern/, @array ;

      then it is to mentally parse several lines of code in and a "for" loop.

      Same is true with reg expression which often replaces dozens of lines of code. A reg exp almost always contains a single thought and if you take a page to express that thought it is harder to understand. Higher level code (such as Perl) results in code with lower complexity.

      Can you elaborate on what you mean by named parameters. Are you refering to something like Perl's symbolic references ? Or can you achieve the same result with symbolic references ?

    8. Re:Java is verbose by rcromwell2 · · Score: 2

      Even though I primarily do web programming, salary surves contradict you. Leaving aside options, the highest salaries are not among web programmers. Y2K consultants even rakened in more. Even admitting stocks and options, there are far more millionaires at Microsoft and Cisco than there are at Yahoo and E-Bay. Overall, most web startups are losers, not winners, with the stocks/options turning out to be worthless, or worth only a few hundred K. TheGlobe, VA Linux, and other mega-IPOs are the exception, not the rule. Web jockeys are starting to become a dime a dozen, doing web-to-database programming isn't exactly rocket science.

    9. Re:Java is verbose by rcromwell2 · · Score: 2

      That's not terseness, that's just proper design.

      The same line of code could be written as

      sub_array = grep(pattern, array);

      in C/C++/Java. Or

      sub_array = array.grep(pattern)

      You're arguing that a Java programmer would INLINE a for loop to iterate over it, but I would argue that most programmers would provide a subroutine for this idiom.

      Neither is really superior. On the other hand, typeless variables cause more confusion the first time a coder looks at them. In perl, I can't just look at a subroutine declaration to determine what it returns. I have to seek out and check all return() statements within the routine to determine the range of types.

      The following code

      $obj = new MyObject($foo);

      $blah = $obj->func($bar);

      Provides no clues from context. Whereas

      MyObject obj = new MyObject(arg);
      Record r = obj.func(bar);

      makes it clear what 'r' is, and what documentation I should look up.

      As for named parameters, in C, C++, Java, Eiffel, and just about every stongly typed language, in addition to Lisp, etc, you can declare the types and names of subroutine variables

      public int add(Complex c1, Real r2);

      whereas in Perl, this looks like

      sub add ($$) {}

      With C/C++/Java, the arguments are passed by reference and by copy into the named parameters. With Perl, either peope write code like the following

      sub foo ($$)
      {
      my $blah = $_[0] * $_[1];
      }

      which in my opinion, sucks, because looking at the subroutine, you have no idea what the arguments represent. You may as well write a program where every variable name is $x, $x1, $x2, etc. There *are* valid reasons for choosing verbose function and variable names to provide better understandability. You either make the variable names understandable, or you have to write very nice documentation.

      To continue on, to name variables, you have to explicitly copy and assign them.

      sub foo ($$)
      {
      my($interestRate, $principle)=@_;
      my $interest = $interestRate * $principle;
      }

      The situation gets worse with OO, since you must remember to always pass "this"

      sub calc
      {
      my($self, $principle}=@_;
      return $self->{interest}*$principle;
      }

      Finally, Perl encourages broad use of implicit unnamed variables. Like, for instance, $_. Most of the library operates and returns data on these variables by default if unspecified. Convenient, but hard to understand unless you have completely mastered and memorized the function prototypes for all the perlfunc's, otherwise, the functioning of a particular piece of code is unclear. Perl allows either method, my person style is long variable names, argument checking, carp, assertions, and documentation, when I am writing code *for other people's use*

      Let's not even mention context-sensitive functions which work differently depending on whether they are used in a scalar or list context.
      Or, what about all those global $ variables like $;, $>, $, $', $`, $*, ... add infinitum (yes, there is the english module now)

      I'm not bashing perl, I've been writing Perl since 1991, and I've written some very significant modules and projects using it. I love perl.

      But the people bashing verbose languages, strictly-typed languages, etc don't seem to understand the purpose of these languages, or why people want to use them. Hint: It's not because they are "idiots", and it's not purely for performance reasons.

      Eiffel's design-by-contract is a perfect example. Eiffel is the language that Java should have been. All the verbosity in Eiffel forces one to do is to *THINK* about what your designing, and declare/document how it works or should work, to both the users of your code library, and to the compiler.

      I'm for pluralism. I can't stand the "Linux only!" or "Perl only" crowd. You use what works, and everything has its place.

    10. Re:Java is verbose by Camel+Pilot · · Score: 1

      Sure you can concoct your own set of standard string handling functions and implicit loop functions, but yours would look and behave different then mine and both would probably suffer in performance compared to Perl's built in functions. In fact, every C or Java programmer typically accumulates a set of of standard libraries functions to do simple things such as grep. Perl just puts them together in a nice neat package.

      As far as prototypes go I have always failed to understand the value for all the trouble. If you use meaningful variable names the context is almost always clear. A language can never compensate for bad style or design.

      And finally no one is suggesting Perl should replace all strong typed languages. As Larry often points out Perl is written is C and for good reasons. However, we are talking about Java and Java is finding it most important use as server side programming. Therefore I am suggesting that Perl compared to Java provides a significant productivity enhancement in that environment. IMHO well written Perl is faster to develop in, easier to understand, cheaper to maintain, and performance is often amazing.

    11. Re:Java is verbose by rcromwell2 · · Score: 2


      Well, using Perl to concoct HTML and output HTML is nice and faster to develop in, but I wouldn't argue that it is "cheaper to maintain" or "easier to understand"

      Most people are trying to move away from the ugly technique of embedding DB code directly into the presentation view.

      Why? Because business logic and data modeling should be separate from presentation layout.

      As an examine, I use Java to generate XML, SAX parse evens, or a DOM tree. I then feed this dataset into an XSL or CSS stylesheet that "transforms" it into HTML, WML, PDF, Chinese, Spanish, or any number of output formats.

      This XSL or CSS stylesheet can be easily manipulated or edited by non-programmers such as graphic artists.

      The converse is the PHP/TCL/Mod_perl/ASP/JSP/embedding technique which is to embed scripts directly into HTML.

      Editing this HTML, maintaining scripts, reusuing fragments, etc, becomes a pain. When it comes time to upgrade to XHTML, XUL, WML, or output localized versions, all of a sudden, you have to cut-and-paste code fragments and change the surrounding markup to whatever you need (e.g. WML)

      The technique of "streaming" HTML with embedded scripts substituting data (template technique) is quick to develop, and scalable (doesn't waste memory), but it also makes it exceeding hard for non-programmers to modify, makes it hard to reuse presentation code, such as rendering a dataset in multiple markup languages, and generally "locks" you into those templates.

      The Model-View (controller) design mattern is superior, but slower to implement and architect. But it pays off well over time in maintainence, reuse, and allowing non-coders to participate.

      As a great example of this technique, see Mozilla.

      Mozilla has a great XML architecture, using XML for structuring the GUI, CSS for determing their look and feel, JavaScript to control actions, and DTD entities to localize for foreign languages.

    12. Re:Java is verbose by Abigail-II · · Score: 2
      But when it comes time to write the final implementation, why should I care about syntactic sugar vs readability and documentation.

      Syntactic sugar is very important for readability. If you have a function, whose core consists of 10 lines, the function is a lot clearer if it only has 2 extra trivial lines instead of having the 10 important lines burried into 50 lines of mallocs, checking return values of mallocs, garbage collection, painstakingly building lines of text out of fragments, and other braindead lines that are better left to a compiler to add.

      -- Abigail

    13. Re:Java is verbose by Abigail-II · · Score: 2
      Perl's lack of named parameters

      Named parameters are trivially simulated in Perl. Both the style where the caller uses positional placement of the arguments, and the style where the caller does something like:
      func (name1 => $value1, name2 => $value2, ..)

      The former takes one line of extra code:
      sub func {
      my ($param1, $param2, ...) = @_;

      The latter takes two extra lines of code:
      sub func {
      my %args = @_;
      my ($param1, $param2, ...) = @args {qw /name1 name2 .../};

      -- Abigail

    14. Re:Java is verbose by Abigail-II · · Score: 2
      Record r = obj.func(bar);

      makes it clear what 'r' is, and what documentation I should look up.

      Eh, no. The documentation of func should tell you what r will be. Unless of course you use a language with a more sophisticated "context" than Perl has.

      -- Abigail

    15. Re:Java is verbose by rambone · · Score: 1
      Leaving aside options

      Don't - thats how Valley people are getting their primary compensation these days. Salary is just for buying groceries.

      Even admitting stocks and options, there are far more millionaires at Microsoft and Cisco than there are at Yahoo and E-Bay

      Not per capita, not by a longshot.

      Overall, most web startups are losers, not winners

      No risk, no reward.

      Web jockeys are starting to become a dime a dozen

      Who cares? The good ones have already made their millions.

      How are those sour grapes tasting?

    16. Re:Java is verbose by rambone · · Score: 1
      As an examine, I use Java to generate XML, SAX parse evens, or a DOM tree. I then feed this dataset into an XSL or CSS stylesheet that "transforms" it into HTML, WML, PDF, Chinese, Spanish, or any number of output formats.

      As a veteren of the SGML industry, I'm glad to see that someone has finally been suckered into beleiving the entire hook-line-and-sinker model for transforming documents to arbitrary output formats.

      Unfortunately, this model was designed to sell consulting time, not get work done.

      CSS is respectable, but XML is getting fat (hence the fifth columnists in the SML world) and XSL is simply a joke. I'm suprised someone who seems so stuck on language features would advocate a language that features no modularity features whatsoever.

  93. My language is better than yours by Owen+Lynn · · Score: 1

    I think the choice of language matters less than the programmer who speaks it.

    Generally if you become truly proficient in one programming language, it is not that hard to pick up another. They are all tied to machine code, and in some fundamental sense, are the same. The only attempt I've seen to make a language that is different is Intercal. Try comparing that to any other language out there, I dare you.

    Try to be the best programmer you can be, and let the others argue over which ice cream flavor is best.

    1. Re:My language is better than yours by Anonymous Coward · · Score: 0

      I'm sick of learning languages, I firmly believe in using the right tool for the job, but there are so many tools to learn that it's getting tedious. And it's not just learning syntax - that's the easy part - it's learning about the libraries/modules available, and various usage conventions.

      My current language of choice is Perl, and that's mainly due to the highly comprehensive CPAN archive (And also due to its lack of 'data types'). I wish that the modules I have at my disposal weren't dictated by the language I choose to use. People should stop developing languages for a while and start working on more/better language/platform independant calling schemes and interconnection protocols. Then we really would be able to choose the right tool for the job at every step of the process.

      I wish I could use Java for some of my work, but it's been far too closely linked to the JVM - all I want is a native code compiler. Languages don't exist independantly, they exist along with their APIs, and their cultures, and in many cases, their run-time environments (Which must be provided, if anyone else is to ever use them).

      But it looks like I'm gonna have to take a look at Python. In the end, to use the things I want to use, I have to use them in the language they were written in, not the language I choose to use.

      In the end, I'll try any language that doesn't have the letter C in it.

  94. An Open Letter to Python Users by Anonymous Coward · · Score: 1


    Dear Python User:

    I understand that we have some small differences of opinion with regard to programming languages, and that's a very painful thing to me, because it means that the community is divided. As we all know, "a house divided against itself cannot stand". For that reason, I'd like to offer a solution to the problem which should be beneficial to both of us: We'll exterminate you and all of your family. This way, the community will no longer be divided, and the superior uebermenschen of Perl will no longer be bothered by the mindless buzzing of people who program in inferior languages. You, meanwhile, will benefit enormously by being relieved of the need to live out your miserable, wretched, inferior life.

    DIE, INFIDEL! DIE! PERL RULES!

    We will hang you by your heels and devour your liver! Wild dogs will drag your corpse through the streets, and finally we will bury the tattered remains at midnight under a crossroads! Your name will be cursed for eleven generations, and all children born who resemble you will be flayed alive!

    PERL RULES!

    Thank you for considering this little peace offering of mine.

    Sincerely,

    Larry Wall, Perl Central Committee Chief Commissar and Absolute Maximum Leader of All Programmers.

  95. Re:How does Python deal with all types of whitespa by Drinky+Crow · · Score: 1

    There the indentation is rather misleading, in a non-obvious way. (The else gets grouped with the inner if, not the outer)

    Ahhh, but in Python, it behaves exactly as you'd expect it to -- the else is in fact grouped with the outer if!


    case1 = 0
    case2 = 0

    if case1:
    if case2:
    print("case 2")

    else:
    print("Neither 1 nor 2")



    prints 'Neither 1 nor 2'

    if you change the value of case1 to 1, nothing is printed.

    This is why indentation in Python is valuable, once you get past your old C/C++ habits.

    --

    dook, dook, dook!

  96. Perl does have an app like Zope: Iaijutsu by deusx · · Score: 2

    Perl does have an app like Zope.

    Mind you, I'm only pointing this out to say that Perl is not completely lacking in such a 'killer app', not to start another Python war.

    Iaijutsu is an object oriented web content management and application development framework. It has a lot in common with Zope, but diverges in many conceptual areas.

    What's magical about Zope is that it looks, to users, like a content-management system with a simple Web interface that anybody can use. A non-programmer can manage a simple website, using Zope, with little training.

    Iaijutsu does that now. Although I can't mention the names of very many sites because they are clients for my day job, we have quite a few fairly large name clients using Iaijutsu's content management for their sites, intranets, and business-to-business document stores.

    Yeah I know, kinda a weak claim. Just suffice it to say that someone is using Iaijutsu now.

    Thanks to Zope's powerful object-oriented framework, it's easy to build such a site in an efficient and economical way, inheriting (or, in Zope-speak, acquiring) common elements from ancestral objects

    Acquisition != Inheritance. More of a close cousin.

    And you don't need acquisition for efficiency and economy-- on the contrary, I've kept acqusition from permeating the design of Iaijutsu because it seemed to me to be one of the most confusing aspects of Zope. However, acquisition is still possible in Iaijutsu. (There's more than one way to do it! :) )

    Thanks to Zope's built-in object database, it's easy to restructure the site -- for example, by cutting a subtree of objects from one location and pasting it into another.

    I implemented this about 6 months ago.

    Out of the box, in other words, Zope is a useful Web content manager for nonprogrammers.

    Iaijutsu is this right now. However, the documentation is even less complete than Zope's. :) Soon...

    There's a tag language called DTML (Document Template Markup Language) which, like Cold Fusion Markup Language or Java Server Pages or Active Server Pages, mixes HTML templates with programming instructions that can populate these templates with data drawn from SQL stores or Zope's own object database.

    Iaijutsu has this, via Andy Wardley's awesome Template Toolkit.

    However, unlike Zope, Iaijutsu is designed with the philosophy that content, logic, and presentation should be like oil and water. The templates are for presentation-- you do not build application with template documents. This goes against the concept of DTML, ASP, JSP, LiveWire, PHP, EmbPerl, and all the other code-in-page systems.

    You compose content in object properties, applications with object methods, and display content and application results via templates. The only logic in your HTML templates should be only what's required for display. (See XSL for a similar concept.)

    When this mid-level programming environment runs out of gas, you can drop down to Python -- Zope's native implementation language -- to write powerful extensions that communicate intimately with Zope's internal machinery.

    The same ability exists in Iaijutsu. Content and application classes can be written in Object Oriented Perl.

    However, there is also a hybrid Perl/XML format for writing classes online in web forms. And you need not write any perl at all in these class definitions.

    Anyway, I've babbled enough. Just trying to set the record straight, that Zope is not without competition soon. :)

  97. Fortran 77 sux by Rizzer · · Score: 2
    I've had to program in Fortran 77 for scientific work. Put plainly, it's depressing to use (although some of the objections have been fixed up in Fortran 90). One of the most irritating features is the column sensitivity. Continuation marks *must* be in column 6 (or was it column 5? or 7?), the line must be less than 70 characters long. I habitually have to set the compiler options to override the line length limitation. Fortunately fortran-mode in emacs deals adequately with the column position problem. But it remains a painful language to use, nevertheless.

    I've only dabbled so far in both perl and python. Python seems more straight-forward to use, but the white-space sensitivity makes me very nervous. It's like Fortran all over again. Mind you don't inadvertently slip a space character between the tab and the code, or your program will fail, just as Fortran will fail if you put the continuation mark in the 5th (or was it 6th? 7th?) column by mistake.

    Others have already mentioned this, and I give it my full support: make tab indentation optional (allow blocks to be defined by {} for instance) ! Let the programmer choose what the best method of indentation is for readability, not for syntax! Please!

    I could be a lot more confident about using python if this misgiving were to be fixed up.

    Rizzer

    1. Re:Fortran 77 sux by lordsutch · · Score: 2

      If it visually aligns with traditional 8-space tabs, you'll not have a problem. Python certainly isn't as location-dependent as Fortran; all you have to do is choose an indent and stick with it (I personally use 4, but you can use any n>1).

      In any event, I recommend using '(setq indent-tabs-mode nil)' in Emacs to avoid the tabs in the first place (and something like Emacs' python-mode to keep your indentation consistent).

      --
      My Blog. Sela Ward can sell me long distanc
  98. Incremental annoyance by sigwhatever · · Score: 1

    Python holds a special place in my heart, Perl is a troublesome beast I'm coming to grips with. Still, it always bugged me having to write : i = i + 1 instead of i++ In Python. Gary

    1. Re:Incremental annoyance by orcrist · · Score: 1

      Still, it always bugged me having to write : i = i + 1 instead of i++ In Python.

      *Boggle* Is this true? I'm a Perl programmer, and I have been intrigued by Python, though I haven't checked it out yet. The whitespace indentation thing was always a potential negative in my book, but... no 'i++'???? I'm stunned.

      Chris

      --
      San Francisco values: compassion, tolerance, respect, intelligence
    2. Re:Incremental annoyance by Alan+Daniels · · Score: 1

      > but... no 'i++'???? I'm stunned.

      That's because in Python, that "i" isn't an integer, its a *reference* to an integer. Every variable in Python is a reference, so naturally, incrementing it doesn't make sense. :=) When you call "i = i + 1", the reference in i now refers to a new integer value. Try "id(1)" sometimes in Python to see what I mean: Even literals have object IDs. References within namespaces is Python's view of the world, similar to how Perl tries to see everything as a flat memory structure whenever possible.

      While I do appreciate that having "i++" as syntactic sugar would be nice, or possibly having maybe where an integer reference could have, say, a "i.inc()" method or something along those lines, (primitives currently don't have methods, but that may change in the future) nothing like that has been added to the language. As I understand it, allowing "i++" would be stating that a reference to an integer could be changed "in place", meaning that it's possible to change a reference out from under yourself without assigning it. Oh well. I don't see it as a big deal, but that's me.

  99. Slashdot Programming Language Poll by Anonymous Coward · · Score: 0


    It's been done. I don't recall exactly when; more than a year ago IIRC.

    It turned into a massive flamewar, pitting actual programmers against morons (the same ones who whine resentfully about spelling flames) claiming that HTML and batch files count as "programming languages".

    1. Re:Slashdot Programming Language Poll by Anonymous Coward · · Score: 0

      oh man, we gotta do this again. taco puurlease?

      Xah
      xahlee.org

  100. Problems with Python and whitespace by smoondog · · Score: 1

    The whitespace issue debated previously is a big one. Python, IMO, is a worse language because of the whitespace inflexibility. I have problems going from emacs to vi, for example.

    Other problems with python? I don't like that there isn't any c-like short cuts to getting things done like the incrementor ++, or += or -=, etc. I would also like to see a more elegant way to import modules than having to set a python path.

    Don't get me wrong, I use Python all the time. My website was built using it, I just think it could be turned into the new "Uber" language with out much work.

    -- Moondog

  101. Heathen Lisper! We will drink your blood! by Anonymous Coward · · Score: 0


    Sincerely, Perl Central Committee Chief Commissar and Maximum Leader Larry Wall

  102. link them to bash! by freddie · · Score: 1

    ...or to each other, embed ll sorts of interpreters inside each other!!!

  103. The right language for the job (or How Stop a War) by vr · · Score: 2

    I hate it when people argue about which language is better. Usually the arguments boil down to "yes it is" and "no it isn't".

    People should understand that all languages have both strengths and weaknesses, and each time programmers are confronted with a new problem, they should choose the right language for the job.

    I use both Perl and Python. Whenever I want to do some magic with text, Perl is the natural choice for me. Also when it comes to CGI, but that's probably just because I don't know how to do it in Python.
    In this example, C++ or Java would be just plain stupid. Neither language is able to do what Perl can do in as few lines.

    When it comes to GUI stuff, I prefer Python and its Tk interface. The reason is that Python enables/forces me to structure my code (Perl does not, and I'm too lazy to control myself).

    It isn't about "There's More Than One Way To Do It" (TIMTOWTDI) or "Keep It Simple, Stupid" (KISS), but "Choosing The Right Tool For The Job" (CTRTFTJ).

    Thank you.

    vr

  104. Re:Please learn how a JVM works (no, you learn) by rcromwell2 · · Score: 2
    I said: The fact remains that Python/Perl are interpreted, and Java, while being bytecoded, is compiled on the fly to native instructions.

    You said: Java code is compiled to bytecode, not native code.

    But the fact is, you're wrong. Java is *packaged* as bytecode for platform independent distribution, but at runtime, on the vast majority of Java VM's in production use, Java is *NOT* interpreted, but *JUST IN TIME* compiled to, for instance, Intel 386 code. You're the one who needs to learn how JVM's work. Today's modern JIT's perform inlining, subexpression elimination, peep-hole optimizations, code-motion, and some even perform a limited amount of global analysis. IBM and Sun also produce "mixed-mode" VMs which mix interpretation and compilation. They compile the 10% of code that is executed most, and spend lots of CPU time optimizing that code. The rest, they leave to be interpreted. As a result, the VM's startup quicker, and the core "tight loops" get agressively optimized and sit in the CPU's cache.

    Like I said, byte-code is merely a convenient compression technique for source code as far as Java is concerned. Java's byte-code format almost contains enough information to completely decompile to identical source code. In execution, only on the oldest VM's is it strictly interpreted. All modern VM's compile to native x86 code during the loading process.

    I said: 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).

    You said: Which is almost every perl program. Perl has everything and the kitchen sink built in....most userland programs are executing compiled functions...this is why perl typically executes much faster than Java.

    But you're wrong again. Perl typically executes faster on text processing benchmarks because of the builtin regexp. But you cannot conclude from this, that Perl is faster than Java per se. Perl is fast at what it does (and I speak as someone who has written over 100,000 lines of Perl code and have been writing it since 1991).

    However, Perl is slow on numerical algorithms, graphical algorithms, data structure manipulation (or lack, thereof), and any other function not related to sucking in files, spliting and matching text, and shoveling it into lists and hash tables. I love Perl, but the idea that Java is slower than Perl is hogwash. I wrote a ray-tracer in Java and I know for a fact that it would run 100 times slower in perl from simple experience of writing a FFT/convolution algorithm in Perl. So would a browser, or 3D modeling program.

    Objects in perl for example (if you can call them that), rely heavily on using hashtables and lists to "emulate" datastructures that you get in other languages. There is no way that $ref->get_member_variable() is faster in Perl than in Java, for example. The Perl code yields either an array index operation, or a hashtable operation. Both of which are many orders of magnitude slower than object field references in Java which get translated into a 2-instruction assembly code pattern. (yes yes, Perl can slowly manipulate real data-structs via pack/unpack(), but very few .pm modules use this technique)

    Perl isn't even always faster than Java at text processing. In the field of parsers, if Perl has to both parse, and build a parse tree representation of a context free grammar, Java based parsers end up winning, even though Perl has regexp built in, probably because datastructure operations are slow.

    You will soon get the chance to try yourself. Someone is bound to take Perl's XML parser, create an XSLT implementation, and then we can benchmark Perl directly against Java at parsing and transformations. Next time, learn something about Java VM's before you speak.

  105. Go Python -- but better docs, please! by hiendohar · · Score: 2

    I'm an ardent admirer of perl, but no enemy to python -- after all, shouldn't the greater vision of "Tim Toady" extend to other languages if appropriate?

    There are shortcomings in perl (lack of function signatures, array context weirdness, inability to specify non-autovivifying hashes, etc.) that have encouraged me to look to Python for relief while working on certain projects.

    I've found a great barrier, however, in the documentation: the O'Reilly python books, though they parallel the perl books in name, don't approach the quality of the latter.

    Whereas "Learning Perl" offers a conceptual tutorial grounded in simple examples, and "Programming Perl" sets forth the definitive specification and philosophy of the language, the python books both seem to me to take a fairly scattered "cookbook" approach, introducing specific applications of the language, but never offering a comprehensive initiation, either for beginners or experienced programmers.

    Maybe I rely more than I ought to on dead trees, but I've also failed to find worthy online docs.

    Has anyone else out there found better info? Am I wrong in my assessment of Lutz's books? Suggestions for further reading are welcomed!

    1. Re:Go Python -- but better docs, please! by Scarblac · · Score: 1
      The O'Reilly Python books could be better. Generally, most people seem to like Learning Python, and dislike Programming Python - that book is just too chaotic. But a new edition is coming up soon (it's 5 years old or so), who knows, maybe it'll be a lot better.

      But the online documentation is good! It's not as *big* as Perl's, but Perl's is ridiculous :-). See http://www.python.org/doc/current/ or something like that. Follow the links to other doc pages as well.

      --
      I believe posters are recognized by their sig. So I made one.
    2. Re:Go Python -- but better docs, please! by Anonymous Coward · · Score: 0

      Quick Python from Manning Publications is much better than the Lutz books. Atleast you won't fall asleep!

    3. Re:Go Python -- but better docs, please! by kdart · · Score: 1

      I recommend the book "Python Essential Reference". It's not a tutorial (like the title implies), but good to have around when doing serious Python coding.

      --

      --

      --
      The early bird catches the worm. The worm that sleeps late lives to see another day.
  106. Comment removed by account_deleted · · Score: 2

    Comment removed based on user account deletion

  107. And where does PHP fit in? by soldack · · Score: 2

    PHP should at least get a thought. It has many of the features of Perl/Python but is embedded in the html (like asp). It has all the flexibility of Perl. A PHP programmer can write in whatver style works best for him/her.

    --
    -- soldack
  108. Pythons - the scripting language for designers? by sebi · · Score: 1

    I am not a programmer and I have never used Python or Pearl but I once was told a little story: Python was invented by Guido van Rossum. Guido has a brother called Just, who togheter with his partner Eric Blockland is a very well know typeface designer. The two of them have a company called letteror. A year ago I had the pleasure of seeing one of their presentations. Their presentation was showing an overview over their typographic work and all of their applications were made in Python. They said that they were probably the first users of Python and heavily involved in the design process. Maybe thats a reason why the code has to be strictly structured and formated - it was developed with the help of non Programmers. Something every developer for every application should do.

  109. Re:#1 by Anonymous Coward · · Score: 0

    for perl morons who clamor about the power of perl's 'map', check out this perl module

    http://xahlee.org/PerlMathematica_dir/perlMathem atica.html

    ps first serious post in screen order.

    Xah
    xah@xahlee.org
    http://xahlee.org/PageTwo_dir/more.html

  110. Re: Perl/Python faster than Java (Wrong) by rcromwell2 · · Score: 2

    Yes, they should. For example, if the mod_perl version of "big HTML + Hello World" employs the <
    Or, in the JDBC benchmark, are they using the thin driver or the OCI driver? Are they using connection pooling? Are they using PreparedStatements?

    What are the parameters the VM is using?

    Do they using String's or Sring buffers when manipulating text?

    When they load text files, which technique are they using?

    How you write the code matters alot. For example, in Perl, @array = <FILE> is faster than while(<FILE>) { push(@array, $_); }

    I'm not sure I trust their benchmarks as representative either. The only benchmark that seems relevent is the database benchmark

    -Ray

  111. Maybe the difference is expressiveness? by hey! · · Score: 2

    All the arguments about the readability seem to a priori favor Python. I've found Python indeed very readable and when I've had to fiddle with it I haven't had much trouble.

    On the other hand, the best Perl code I've had to maintain is highly readable and if anything even easier to maintain than they Python examples I've worked with.

    Perhaps the difference is the Perl is simply more expressive than Python. I don't mean this in a Turing sense obviously. This can be a blessing or a curse depending on who is doing the expressing.

    --
    Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
  112. WebObjects pricing by LarryTheCucumber · · Score: 1

    Of course, the biggest problem with WebObjects is the cost. Not too many folks can afford the $10,000 entrance fee to get started.

    You can get Mac OS X Server for $499, including a limited version of WebObjects, at the Apple Store. Of course, you need to shell about for a recent Mac if you don't already have one, but it's still cheaper than $10,000.

    -jimbo

    --
    "Hold me Bob!" "I would if I could man!" -Larry and Bob in VeggieTales
  113. What is "expressiveness"? by Anonymous Coward · · Score: 0

    a lot articles fuddle around the word 'expressiveness'.

    Question: the more syntax variation a language offers, the more expressive it is, true?

    Question: some "advanced" languages has constructs that does first class objects, tail recursion, closure, monads, OOP features (inheritance, polymorphism...etc.), dynamic evaluation, pattern matching (on expression structures, not strings), infinite streams, infinite precision arithmetic ...etc. These are not readily present in other languages. Does it mean that these language are more expressive?

    to Perl morons: if syntax sugar quantity defines expressiveness, then Perl is expressive indeed, but have you ever thought about expressiveness in terms of functionality? I code Perl daily for food, but i can tell you it is fairly not expressive at all. (better than C for sure.)

    food for your thought
    http://xahlee.org/PerlMathematica_dir/perlMathem atica.html

    Xah
    xah@xahlee.org
    http://xahlee.org/PageTwo_dir/more.html

  114. expressiveness by Anonymous Coward · · Score: 0

    a lot articles fuddle around the word 'expressiveness'.

    Question: the more syntax variation a language offers, the more expressive it is, true?

    Question: some "advanced" languages has constructs that does first class objects, tail recursion, closure, monads, OOP
    features (inheritance, polymorphism...etc.), dynamic evaluation, pattern matching (on expression structures, not strings),
    infinite streams, infinite precision arithmetic ...etc. These are not readily present in other languages. Does it mean that these
    language are more expressive?

    to Perl morons: if syntax sugar quantity defines expressiveness, then Perl is expressive indeed, but have you ever thought
    about expressiveness in terms of functionality? I code Perl daily for food, but i can tell you it is fairly not expressive at all. (better than C for sure.)

    food for your thought
    http://xahlee.org/PerlMathematica_dir/perlMathemat ica.html

    Xah
    xah@xahlee.org
    http://xahlee.org/PageTwo_dir/more.html

  115. Re:How does Python deal with all types of whitespa by gaj · · Score: 1

    Yup. And in Python you would get a syntax error at the else since the indentation is ambiguous.(assuming that you change the rest of the code to be Python, of course! ;)

    No dangling else issue.

    'Course I never see those in C or Java either, since I *always* use braces, just like you need to for Perl.

    --
    If your map and the terrain differ,
    trust the terrain.

  116. Efficiant by geekoid · · Score: 1

    Ok, so now we're debating readability? how about effiancy? Which one runs faster?
    Whats this talk of not needing comments? All large apps(20,000+ lines) need comments. No not on every line detailing incrementions, but the reader needs to know what Intent the original programmer had at that point in code/time.
    There are several reasond for this, somebodies intent may have been different then the specs, or the specs changed, or your co-worker was taken away to the funny farm, do to "Frag" shock.
    Short, clear concise.
    I'd rather write a few extra lines of comment and use a wicked fast language, then have an easy to read slow language any day. Since I have a couple years of perl, and only about 3 weeks of python, I can not make a judgement on this.
    I was hoping some of you would talk about this, but aparently the amount of comments a Language needs is far more important then the quality of apps.
    Also can you make an executable app in python, like you can in TCL? just curious.

    --
    The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
  117. what is expressiveness++ by Anonymous Coward · · Score: 0

    a lot articles fuddle around the word 'expressiveness'.

    Question: the more syntax variation a language offers, the more expressive it is, true?

    Question: some "advanced" languages has constructs that does first class objects, tail recursion, closure, monads, OOP
    features (inheritance, polymorphism...etc.), dynamic evaluation, pattern matching (on expression structures, not strings),
    infinite streams, infinite precision arithmetic ...etc. These are not readily present in other languages. Does it mean that these
    language are more expressive?

    to Perl morons: if syntax sugar quantity defines expressiveness, then Perl is expressive indeed, but have you ever thought
    about expressiveness in terms of functionality? I code Perl daily for food, but i can tell you it is fairly not expressive at all. There are just many paradigms and functionalities that i cannot do. (of course, i can always implement it, which is just a scaled-down version of saying implementing a compiler in lang x yourself.)

    food for your thought
    http://xahlee.org/PerlMathematica_dir/perlMathemat ica.html

    Xah
    xah@xahlee.org
    http://xahlee.org/PageTwo_dir/more.html

  118. Re: Perl/Python faster than Java (Wrong) by orcrist · · Score: 2

    Well, you were the one saying:
    If you look at caucho.com, they have proof that Java servlets are faster than mod_perl. (emphasis mine)

    The benchmarks I quoted (you did read the thread I linked didn't you?) were just corrections of the Perl code AFAIK. I have no clue about Java, servlets or otherwise; I was just taking issue with your 'proof', which used less than optimal mod_perl (to put it mildly). I'm assuming the authors of your 'proof' were using optimal enough Java code for you, otherwise you wouldn't have used the magic word: 'proof'. The persons who sent the corrected benchmarks merely improved the Perl and ran new benchmarks. These benchmarks are proof that the original benchmarks aren't proof, and that's the only claim I'm making.

    Chris

    --
    San Francisco values: compassion, tolerance, respect, intelligence
  119. Functional Scripting Langauges by Weezul · · Score: 2

    I don't really trust the idea of an OO scripting langauge. Ok, well smalltalk could dose it when it tries, but not these procedural/OOP hybrid things like Python. It seems all the advnatages you get by OOP are nullified by the space constraints of scripting. Plus, they are not really inovative enough, i.e. part of making a langauge fun is making it weird in meaningful ways. I think the relevent quote is "A langauge which dose not teach you something about programming is not worth knowing."

    Now, a monadic functional langauge like Haskell might make an interesting scripting langauge if you standardised all the tools (like regex) since it is so quick to write code in these things (monadic means you can do neet things like OOP and IO without really cheating the way lisp dose). I would really like to see someone perlify Haskell, i.e. say "we have enough syntatical purity for now, so lets be preatical and figure out how to make the langauge human without loosing too many of our cool functional short cuts." It's just really fucking cool (and very relevant to scripting) to be able to define a subtil algebraic datatype in like 2 or 3 lines. Plus, all the advantages of being able to extend things like regex on the fly (since they are actually in the langauge). The only real problem is that no one like Larry Wall has come allong to make a more fun & human version of the Haskell. Imagine all the weirdness of Haskell with all the weirdness of Perl.. that would be wonderful.. :)

    --
    The Christian religion has been and still is the principal enemy of moral progress in the world. -- Bertrand Russell
  120. lets try it by JoeS[AGN] · · Score: 1

    anybody know where i can download python?? it seems like the ideal language for a newbie (relativly) like me to begin his quest into the world of coding.

    1. Re:lets try it by Anonymous Coward · · Score: 0

      At www.python.org surprisingly enough.

  121. Re:Please learn how a JVM works (no, you learn) by rambone · · Score: 1
    But the fact is, you're wrong. Java is *packaged* as bytecode for platform independent distribution, but at runtime, on the vast majority of Java VM's in production use, Java is *NOT* interpreted, but *JUST IN TIME* compiled

    Then you need to make the distinction. javac and alternative JIT systems are considered distinct in Java-lore, and you know it.

    Like I said, byte-code is merely a convenient compression technique for source code as far as Java is concerned.

    This is not correct - bytecode can include compile-time optimizations.

    All modern VM's compile to native x86 code during the loading process.

    That must be a real drag on a Sun box.

    Perl typically executes faster on text processing benchmarks because of the builtin regexp. But you cannot conclude from this, that Perl is faster than Java per se.

    Benchmarks are irrelevant - I care about the speed of working code I use everyday, in which case Java gets easily trounced by a number of other languages. If you want benchmarks, try The Practice of Programming by Kernighan and Pike. Its unbiased, unambiguous, and clearly shows what a dog Java is.

    Objects in perl for example (if you can call them that)

    Oh please, Java has the worst performing class library anywhere, even Javaworld.com lists articles describing this in detail. Besides the absurd object churn and heavy syncrhonization, Java's approach to objects is heavily verbose and basically treats developers like idiots.

    Perl isn't even always faster than Java at text processing.

    More conjecture. Provide hard data or clam up, cuz common wisdom says your full of it in this regard.

  122. Re:How does Python deal with all types of whitespa by Scarblac · · Score: 1
    I really don't know why Python programmers reject the concept of bracket characters (or words as in languages like Pascal).

    One reason I haven't seen mentioned yet is that it saves vertical screen space. A } or 'endif' will usually be on a line of its own.

    Studies have shown that pieces of code become harder to understand as they become longer[1] - with a steep increase when the code becomes longer than a page, regardless of the length of the page. You have to scroll up and down to see it all.

    One number I've heard is that a big (few hundred thousand lines) Modula project (Modula uses 'end') had 1 in 6 lines that only had 'end' on them. That means that a Python function can be around 20% longer than the same function in a language that uses end marks, for the same readability.

    Btw, most of those 'confused cases' where the programmer uses an odd indentation scheme are simply a syntax error in Python. Yes, if he moves some line a complete indent to the left or right, it may be actually legal sometimes, and mean something else. That can only happen on the last line of a block. Then you have a bug. You get bugs with misplaced braces as well.

    -- Remco

    [1] Although I'm checking this in Steve McConnell's Code Complete now, and the studies *he* cites say it's no problem. I still like them smaller than a page, myself. Besides, Linus' CodingStyle agrees, and this is Slashdot.

    --
    I believe posters are recognized by their sig. So I made one.
  123. Why Tcl is better than Perl by Anonymous Coward · · Score: 0

    http://dev.scriptics.com/advocacy/perl.tml

  124. Real Programmers don't comment?! by Wench · · Score: 1

    First time I've seen this attitude expressed in real life for quite a while...

    Apparently you also don't believe in maintenance, or collaboration. Or perhaps are trying for job security through indispensability. Or have no job.

    This is not a perl vs python issue, either. I wish the python coders whose work I have to maintain or interface with had bothered to comment their code.
    It is NOT true that you don't need to comment python. Who came up with that nonsense? I keep hearing it.

    As to the original post: well, I found that when I was learning I wrote those sorts of comments. And when I looked at the code 6 months later I took out the comments that explained syntax, and left the general functionality ones. Don't sweat it.

    --
    No matter how cynical you become, it's never enough to keep up.
  125. Re: Perl/Python faster than Java (Wrong) by Baldrson · · Score: 2
    How can JPython run Python as fast as CPython, yet Java be *slower* than Python? I don't think so.

    The same way a "C" program can be faster than the assembler version of the same program:

    Expressing the problem specification at a higher level allows greater degrees of freedom to the optimization machinery.

    Think about how much you hate being micromanaged and why...

  126. We don't need no stinkin' examples! by Jack+William+Bell · · Score: 2

    Can you post an example of TIMTOWTDI vs. KISS?

    With as little time as I have today to research and create such examples I am certain anything I do will be picked apart and I will be shown (by proponents of both sides) multiple ways that I did something stupid in my examples. I would rather concede the point than start that kind of pointless one-upmanship. Perhaps someone else wants to take up the gauntlet?

    I think the tersness of PERL code and the obfuscated feel of it (IMO) are a result of the syntax and how so many things have been added to the language. . .

    Which was most of my point in the original post.

    . . . not that it some how liberates you to code things that python doesn't in the name of performance.

    Which is missing my point -- I was saying that, in a general way, providing many different ways of doing similar things often provides you with an opportunity to pick the most optimal one for a particular task. But I also implied that it takes a guru to do that. Not everyone is a guru.

    . . . Larry has added everything including the kitchen sink to PERL. Guido is very careful about adding new things to python. . .

    Which is why I prefer Python to PERL, Objective C to C++ and so on. I tend to believe the 'Kitchen Sink' approach to language design has the long-term effect of making it difficult (or at least not helping) to create maintainable code. And, as a business programmer and lead developer, maintainability is my primary concern. Clearly bad programmers can mess up Python and good programmers can write readable PERL and you cannot do anything in one language that you cannot also do in the other. But PERL was designed to write code quickly, not to write code well.

    Conversely Python was intentionally designed to promote those things known to create readable/reusable code! And for that I say cheers to Guido; may he never decide to start dumping things in for the sake of bullet points...

    Jack

    --
    - -
    Are you an SF Fan? Are you a Tru-Fan?
  127. First order object (was Re:TIMTOWTDI -vs- KISS) by Grey+Haired+Luser · · Score: 1

    A easy, working definition of a first order object is one which the language can create an manipulate at runtime. Thus, in C, integers and arrays are first object, but, functions, say, are not. i.e. you have to *write* a function and recompile your program to have a new function appear in your system. In lisp, for example, functions *are* first order---you can write your program to create new functions as they are required at runtime.

  128. Re:Compiler-level optimization by Jack+William+Bell · · Score: 2

    I can't argue with that, but we are talking interpreted scripting languages here. If they are compiled at all it is to a p-code level which is then interpreted on a virual machine. Now the virtual machine itself can provide run-time optimization, but it will be optimizing the p-code which might be a wash between the two languages.

    Besides, everything I had to say was a general case anyway. As I mentioned in another post, any attempt to get specific can lead to code one-upmanship where different gurus compete to show how you missed this keyword or that compiler switch. My point was that I don't care if PERL is faster or requires less lines of code to do the same thing. I prefer Python because I write code (and direct others in writing code) that has to last (and be extended) for years. Terseness is not cool in that kind of environment.

    Visual Basic was the COBOL of the nineties. Python may well wear the crown for this decade! And if you don't understand the point about COBOL, let me point out that there are billions of lines of COBOL, originally written in the seventies, running the businesses of the world even today. Perhaps it is not sexy, but business software makes up most of the code on the planet...

    Jack

    --
    - -
    Are you an SF Fan? Are you a Tru-Fan?
  129. Override tabulation with spaces in VIM by Anonymous Coward · · Score: 0
    (Posting as an AC because I've already moderated in this discussion)

    If you use VIM (like I do), you can use :set expandtab and VIM will convert your tabs to spaces. Combine that with :set softtabstop=4 (or whatever your preferred tab setting is) and VIM will still read tab-containing files with 8 tabs, but will insert 4 spaces per tab when you press the TAB key. Highly useful for "one tab == one indent".

  130. Game Over by Baldrson · · Score: 2
    Python isn't compellingly better than the Perl/Javascript combo. Perl/Javascript already has such a dominant position that by the time Python's growth rate matters (Javascript's growth rate is much higher), Perl/Javascript will:

    Already have displaced Java (not to mention C++) on servers and clients.

    Start being displaced by a next generation technology -- thus crowding out any potential play for dominance Python might have had.

    For a look at a next generation technology, any of the distributed declarative semantics systems would do (the most commonly referenced ones being RDF-like). However, at present, my money is on something at least as capable as Mozart.

  131. How Python sucks: by TheDullBlade · · Score: 2

    I'm not writing about how Perl sucks, because the way in which Perl sucks are well documented: auto-obfuscated, too focused on text processing if you want to do something else, etc.

    Perl sucks at some stuff for good reasons, or at least because it is getting old and new stuff had to be kludged in oddly to avoid breaking too much old code. Python, on the other hand, seems to suck because Guido was taking shortcuts when he wrote the original parser and engine, and then never cleaned them up.

    The colon: with all this nice, minimal syntax, why oh why do you have to start each block with a colon? You already have the indentation, and you know the line has started at the line break, so why would this superfluous character be included? It's always there, so it provides no useful purpose and you shouldn't have to type it. If it was optional, to be used for single-line blocks, then I would understand, but as it is, it's as silly as if you had to end every line with a semicolon.

    The "self" variable: okay, I can sort of accept typing "self" every time I want to access a member, but why do I have to explicitly include it in the declaration of every single method? It is always there, yet you have to type it in again every time!

    Why don't the lists efficiently and trivially act as dequeues, like in Perl? A great many problems become trivial with the application of a hash (fortunately present), stack, or queue. A fair portion of Programming Python is dedicated to examples of working around the fact that Python doesn't come with an explicit stack data type built in. The simple inclusion of push, pop, shift, and unshift methods for lists would have standardized and simplified a whole class of problems.

    Why can't I specify what data members my class has? If I mistype a name, I want a compile-time error! What kind of class definition doesn't include explicit data members? The mind boggles...

    Butt ugly operator overloading: when I define I symbol, I don't want to call it by another name! Use quotes, or use a single new overloading keyword, but don't make me remember a new keyword for every single operator.

    No '+=' type operators: I can live without '++' quite happily, but with names stretched by OOP, I just can't stand having to type 'self.objectList[self.currentObject].counter = self.objectList[self.currentObject].counter + 1'. The need for cutting and pasting is a flaw in any language.

    No adequate goto replacement: even though Perl has a goto, it also provides an excellent way to avoid goto altogether: the next, last, and repeat statements. With these you can break out of deeply nested loops without any stupid flags or gotos.

    These all seem like trifling, silly little things, but in a scripting language, it's the little things that count most, and I've only touched the tip of the iceberg of all the annoying little things in Python. Much as Python people like to talk about the superiority of Python for large-scale projects, I usually reach for a scripting language when I want to hack something with a couple hundred lines of code; if I end up cutting and pasting stacks, or having to write modules for such an elementary function, or otherwise including standard "boilerplate", I might as well go use C++. These are actually major reasons I chose not to switch from Perl to Python.

    Python has some really incredible ideas, and borrows some good stuff from Perl. Unfortunately, it fails to steal the very best ideas from Perl, doesn't follow out its own best ideas to their logical ends, and does some other really dumb stuff for no apparent reason. It's a tragedy, because the clean syntax, OOP support, and list handling (except for the dequeue thing) is so superior to Perl it's not even funny. Even with all these flaws, it was a very near race, and I probably would have stuck with Python if I had learned it first.

    --
    /.
    1. Re:How Python sucks: by Roberto · · Score: 1

      Some of the criticisms, I agree with (say, the colon ;-)

      However, there are some that are just lack of knowledge of python. For instance, the 'self'.

      Why is it extremely nice to have self declared explicitly? Because you can do things like this:

      class dummyclass:
      pass

      def myfunc(self,args):
      (do something interesting here)

      dummyclass.func=myfunc

      The same thing is true about data members in classes. Not defining them lets you add extra data members per instance, which you can use as, for example, persistent values for functions (like a static C++ variable in a method)

      Besides, it lets you extend a class and have the extension apply to all the instances!

      class dummy:
      pass
      a=dummy()

      dummy.num=5
      print a.num

      will give a 5 :-)

      This is very very cool and lets you do all sorts of interesting stuff, like classes that extend themselves by plugging other classes into them.

      Besides, if you really want... you CAN fix the data members of a class, except it will only cause a runtime error, not a compiletime one, by overriding the mechanism for attribute changing.

  132. How do you set python mode in emacs? by Anonymous Coward · · Score: 0

    I have been using linux and freebsd for a year but I am afraid to fool around in vi or emacs.

    I got the "Unix Power Tools" hand book and and practiced using both but I do not know where I can find info on how to setup emacs or vi to use python mode, c mode, or even lisp mode.

    If any of you know a cool website or book that shows me more then basic functionality, I would really appriciate it.

    With no university cs or engineering background, its tough to learn it.

    1. Re:How do you set python mode in emacs? by Anonymous Coward · · Score: 0

      I'm afraid I can't help you out with your question, however, if you will allow me to comment on what you said about being a cs/engr major contrary to what you (might) believe being a cs/engr major (definately) doesn't mean you know anything about computers, believe me, I am one and I know first hand. Thanks.

    2. Re:How do you set python mode in emacs? by Anonymous Coward · · Score: 0

      Please excuse my bad usage of the English language... What I meant to say was: please don't be discouraged by thinking only cs/engr people can learn programming. I won't be surprised if you don't already know more than them now! Thanks.

    3. Re:How do you set python mode in emacs? by Anonymous Coward · · Score: 0

      If your system is set up correctly it should be set automagically whenever you open("find" in emacs-speak) a file with the .py extension. Or you can do M-x python-mode. If python mode is not installed in your system either get yourself a Real Distribution(TM) or install it yourself from http://www.python.org/emacs/python-mode/. You don't need a CS degree to use emacs. It comes with lots of built-in documentation: look in the help menu - there's a tutorial and inside the info thingy (C-h i) there's a manual. There's also an O'Reilly book about emacs.

  133. perl is not what it is claimed to be by bcaulf · · Score: 1

    I like and use Perl plenty. But Perl enthusiasts love to paint it as a language for all users and all purposes, when it really more demanding and specialized at heart.

    IMO, Perl has a well defined role as a powerful scripting language for users who know the Unix environment. Perl is an awk-sed-sh synthesis with a C syntax. I am a big awk and sed fan so it pleases me just fine to use perl for the same things I would use awk or sed for: (regex based) text and flat file db processing. But to build large systems with large numbers of developers in this kitchen sink of a language is stupid. It is so big, so cryptic, that unless everyone on the team is a $150/hr Perl god, you are going to wind up with a mess as junior people produce unreadable, wordy crap. You have to be some kind of Talmudic scholar to be able to read and write all common styles of Perl.

    Perl does not have anything resembling a reasonable overall syntax or semantics. Is there any such thing as a truly correct syntax-aware editor for perl? When emacs can't parse a language you are in trouble.

    The Perl community has some funny sayings. "Baby talk is OK." That's because unless you are coming from the right C-sh-awk-sed background you are guaranteed to misuse the language.

    "TMTOWTDI." Like my and local? ' and ::? Dereferencing with %@ vs. ->[]{}? Or all the myriad ways to structure a simple object? Ack! Too many ways to do it for code to be readable.

    The perl interpreter is really weird and crazy under the hood, which doesn't make the language any more attractive for high reliability work.

    Perl is a Unix hacker language, with most of the same mysteries and ways to shoot yourself in the foot as sh and friends. Mere mortals should use something with more rules and fewer options.

  134. Re:Please learn how a JVM works (no, you learn) by rcromwell2 · · Score: 2

    I said: But the fact is, you're wrong. Java is *packaged* as bytecode for platform independent distribution, but at runtime, on the vast majority of Java VM's in production use, Java is *NOT* interpreted, but *JUST IN TIME* compiled

    You said: Then you need to make the distinction. javac and alternative JIT systems are considered distinct in Java-lore, and you know it.

    What's your point? Nothing in the Java language spec says that "Java must be interpreted", Javachips exist, and even Transmeta demonstrated byte-code executing directly on their CPU. TowerJ, TurboJ, VisualCafe, SuperCede, Jove, and even GCJ all demonstrate direct native compilation of Java.

    Java bytecode is nothing more then a intermediate compiler stage, just like GCC's RTL, or other intermediate compiler languages.

    What matters is the real world implementations, and in the real world, most Java VM's use JIT compilation, and thus, are not executing intepreter loops, but translated bytecode-to-native code.

    You can play semantics all you want, but you're still wrong. Perform a random sampling of Java VM's, and run a numerically intensive benchmark. Next, pick a random sampling of Perl implementations and run a similar benchmark. The result will be that Java will execute most low-level operations faster because of the preponderance of JIT's combined with the usage of real structs vs perl-pseudo datastructures. End result: Java is faster, contradicting your claims.

    I said: Like I said, byte-code is merely a convenient compression technique for source code as far as Java is concerned.

    You said: This is not correct - bytecode can include compile-time optimizations.

    There are also *source code optimizers* out there which can perform transformations of C code without even compiling it. Technically, GCC does a lot of optimization at the RTL level, but again, RTL is just an intermediate representation.

    But that's moot. In the real world VMs on Windows, Solaris, HP-UX, inside Oracle, on Tru64 UNIX, under OS/2, in AIX, and even on OS/390, Java bytecode is rarely interpreted. JIT's are used by default on all these platforms. You're basically wrong.

    I said: All modern VM's compile to native x86 code during the loading process.

    You said: That must be a real drag on a Sun box.

    Hahah, trying to score debate points by nitpicking? Must be desperate. By the way, on my Solaris x86 box, it does indeed, translate bytecode to x86 code.

    You said: Benchmarks are irrelevant - I care about the speed of working code I use everyday, in which case Java gets easily trounced by a number of other languages. If you want benchmarks, try The Practice of Programming by Kernighan and Pike. Its unbiased, unambiguous, and clearly shows what a dog Java is.

    Let's stick to the topic at hand and compare Java to Perl execution speed, which as your original claim. I don't want to get into the C/C++ systems level debate. I view C personally as barely a step above assembly programming.

    You claimed Java is a dog compared to Perl. *PROVE IT* Show me the applications your wrote in Perl and Java, otherwise shutup. For all intents and purposes, Java and Perl perform well enough to do most run-of-the-mill tasks like formatting database data on websites, and processing text.

    If you want to bring C into it, I'll note that Perl is total DOG compared to C if you want to write a database, search engine, computational fluid dynamics, symbolic math, ray tracing, or video game in it.

    So stop your FUD. You don't like writing Java code? Fine. You don't like Sun? Fine. But don't spew outright lies without backing up your claims, otherwise, someone is going to call you on them and embarrass you.

    I said: Objects in perl for example (if you can call them that) (I proceeded to explain Perl's idea of a datastructure vs Java's)

    You said: (obviously ignorant) Oh please, Java has the worst performing class library anywhere, even Javaworld.com lists articles describing this in detail. Besides the absurd object churn and heavy syncrhonization, Java's approach to objects is heavily verbose and basically treats developers like idiots.

    Hahaha. Java's approach to objects is heavily verbose? Compared to what? C? C++? Eiffel? Objective-C? Smalltalk? Java syntax for objects is virtually lifted straight out of C/C++.

    Object churn? Perl excels at this. Before Perl5, there wasn't even a way to pass structures, arrays, or hashes by reference. (Except for a hack technique using globals or aliases). Everytime you passed or returned data, you ended up making a copy, except if you only passed scalars and didn't copy them with the local(named args)=@_ technique. Perl5? Still tremendous object churn with arrays and hashtables being created up the wazoo everytime you do anything.

    Boy, you sound ignorant. Please list those Javaworld articles, haha. Yeah, they criticized the old Vector/Hashtable, but of course, the newest HashMap/ArrayList perform much better, even better than the JGL, which they lauded, which is the Collections API won the Editor's Choice award.

    I said: Perl isn't even always faster than Java at text processing.

    You said: More conjecture. Provide hard data or clam up, cuz common wisdom says your full of it in this regard.

    Easy. Just go grab the XML modules for Perl5 and compare the speed of the nonvalidating parsers against AElfred or XT on Java. (the Perl validating parsers would fare even worst) Next, go grab some XSLT modules in Perl for transforming XML. Now compare the performance to James Clark's XT, SAXON, EZ/X, Apache's Java XSLT project, or Oracle XSLT. I'm not going to run the benchmark for you, but if you run a dejanews search, you'll see some comparisons. We're talking an order of magnitude difference in some cases.

    But enough about me, you're the person who opened his mouth and made the initial claims. *YOU* back them up. The burden of proof is on *YOU*, the person making the claim. If you can't, shutup.

  135. Re: Perl/Python faster than Java (Wrong) by rcromwell2 · · Score: 2


    Every JPython function is translated ultimately, to Java bytecode, so if Java's execution speed is slower than "Python", than JPython cannot be faster than Java since it is doing nothing but executing Java code!

    JPython's "optimizer", which executes Java code, cannot run faster than Java, period. If I write a for() loop in Java, and one in Python, Python will be slower. The only way if could possibly be faster if it Python "removed" the loop, but Python doesn't do this.

    Besides this, Python isn't much "higher level" than Java.

  136. Just one thing I must state. by Anonymous Coward · · Score: 0

    perl can just as easily create a list of lists of hashes of whatever and in one line as you have put.
    @a=(["a","b","c"],{"c" , ["d"]});

    This line assigns to the array @a an array with two elements. First element is a reference to an array with elements "a","b","c", and the second element is a reference to a hash which has "c" for a key and an an reference to an array ( which contains "d") as the value. If you want to group the key value pairs, you can always use the '=>' operator or somesuch.

    Tell me how that is any more hideous than x=['a','b',{'c':'d','e':['f','g']},['h',['i','j']] ] ? In fact I would say the syntax is strikingly similiar.

  137. Re: Perl/Python faster than Java (Wrong) by consumer · · Score: 1

    I was involved in this test. As someone else pointed out, we didn't write the Java; the guys at caucho.com did. All we did was fix the Perl code. I have to assume the Java code was written with speed in mind, since it was used to highlight the speed of their JSP tool.

    This was simply a test between two programming environments we were considering. The results came out close enough that we decided we couldn't make a decision based on performance and ended up making it based on other factors.

    Caucho's Resin is great, but don't underestimate the performance of mod_perl.

  138. Re:Please learn how a JVM works (no, you learn) by rambone · · Score: 1
    Perform a random sampling of Java VM's, and run a numerically intensive benchmark. Next, pick a random sampling of Perl implementations and run a similar benchmark

    You make two separate references to claims for perl vs. java benchmarks. I already gave you one in my previous post - Kernighan and Pike.

    Object churn? Perl excels at this. Before Perl5

    Perl 5 is over five years old. Thats older than any production quality JDK. If you honestly expect me to take seriously a comparison of Java vs. Perl 4 (which is six years old), you're off your rocker. Of course, these are the only types of serious comparisons Java can handle. I'm sure Java is also quite favorable when comapred to PL/1.

    Java syntax for objects is virtually lifted straight out of C/C++

    Except they made Java both idiot proof and poorly performing by removing the virtual keyphrase. With Java you pay for a vtable whether you want it or not.

    But lets face it, that is what Java is all about - making OO idiot-proof for the masses. Unfortunately, you get pissed on in the performance due to Sun's over-reaching assumptions.

    I'm not going to run the benchmark for you

    Thanks for playing, you've barked about benchmarks numerous times in your post but are unwilling to provide your own (even when I've given you a clear reference to a good unbiased comparison of perl and Java).

  139. Re: Perl/Python faster than Java (Wrong) by warmi · · Score: 1

    Heeheh ... assembler version ?
    You know, C _is_ assembler version when it gets executed.

    "Expressing the problem specification at a higher level allows greater degrees of freedom to the optimization machinery. "

    It is exactly the other way around.
    It is true that sometimes compiler can generated better asm code than begining asm programmer but only because it has hardcoded knowledge about particular ASM. However, hardcored knowledge can't compete with flexible mind the same way, expert systems can't compete with real thinking person ...

  140. Re:Please learn how a JVM works (no, you learn) by rcromwell2 · · Score: 2
    You make two separate references to claims for perl vs. java benchmarks. I already gave you one in my previous post - Kernighan and Pike.

    The TPOP benchmark was debunked a long time ago. Even TCHRIST didn't like it, even though it showed Perl leading. In fact, the first sloppy implementation showed C++ to be the slowest. (they retracted it) Pike/Kernigan are not exactly "unbiased" anymore than Bjarne S is, or the creator of Eiffel. And we known Tchrist isn't.

    The Perl implementation uses a two-dimensional hashtable which requires an O(1) lookup to locate a prefix.

    The Java implementation on the other hand, is totally different. It uses an object as the Hashtable key, it doesn't cache the value of the hashCode() function, the hashCode() function and the equals() method are both O(n) worst case. Thus, a large amount of time is spent calculating hashcodes, and because they don't preinitialize the hashtable, those objects get rehashed as the load factor goes up.

    Continuing on, they don't use a BufferedInputStream for reading, they use StreamTokenizer on an interactive stream (docs warn against it), and of course, the benchmark was ran on an old VM.

    I modified the code to use buffered I/O, and HashMap/ArrayList, plus hashCode() caching, and ran it on IBM JDK1.1.8 (with javax.util.collections) and JDK1.2.2 -classic. The result? My running time on a Celeron 400Mhz on Windows 2000 running JDK1.2.2 was 2.8 seconds total (not 9 seconds), and subtracting the startup time of the VM yields a runtime of 661 milliseconds, only 50% slower than their C-benchmark and 3 times faster than Perl (1.8 secs). If you leave in the startup time, 2.8 still isn't bad (vs 9 seconds they listed). Under JDK1.3RC1, the startup time reduced to yield 2.1 seconds total.

    And of course, this is hampered by the inferior implementation they used. Let's switch to a 2-dimensional associative array approach and then do a comparison.

    Except they made Java both idiot proof and poorly performing by removing the virtual keyphrase. With Java you pay for a vtable whether you want it or not

    Patent nonsense. In the first place, you can use "final" if you want to. Non-virtual functions are idiotic, and cause a nonstop source of headaches in C++ code. See "Effective C++". virtual functions aren't slow, and in most cases, a C++ compiler can replace it with a direct dispatch.

    Nevertheless, what makes it even more nonsense is that Java JIT's have enough dynamic type information at runtime to *INLINE* virtual functions. HotSpot does this, by profiling code at runtime, and replacing dispatch sites an inline version. The technique is no more sophisticated than branch prediction in CPUs.

    Smalltalk compilers have been doing this for a while too.

    But lets face it, that is what Java is all about - making OO idiot-proof for the masses. Unfortunately, you get pissed on in the performance due to Sun's over-reaching assumptions

    Yeah, anyone who wants type safety is a idiot. And of course, you're a master programmer right? Programming in an idiot-proof language with automatic resource reclaimation (Perl), because you're not smart enough to write code in a real man's language like C or C++. Haha!

    P.S. You're still wrong on performance. But keep writing your "top 5" website code, haha.

  141. Yahoo! We finally have a flamewar! by DragonHawk · · Score: 2

    Geez, an "X vs Y" story and I have to scroll almost all the way to the end of the article before I find even a single flamewar! What's Slashdot coming to? Still, I suppose you earn some extra points by making the flamewar off-topic as well....

    ;-)

    --

    dragonhawk@iname.microsoft.com
    I do not like Microsoft. Remove them from my email address.
  142. Python's documentation strings by Colin+Simmonds · · Score: 1
    It is NOT true that you don't need to comment python. Who came up with that nonsense? I keep hearing it.

    It's probably because Python encourages clean, readable code, and has mechanisms that make it easy for code to be self-documenting.

    Which brings up one of the features I love about Python that hasn't been mentioned so far -- document strings. Modules, functions, classes and methods can have a constant string before any statements that is available at runtime as the __doc__ attribute. I find that this encourages me to write one for each of these entities as I create them, so that's there always a brief description of what a given procedure or class is meant to do.

    Because they're available at runtime, they can serve to document code even when the source is unavailable. For example, a couple of weeks ago I was working with one of the libraries in the MacPython distribution that wraps part of the Mac toolbox. This library wasn't documented and was only provided as a binary shared library, so it wasn't clear how it was to be used. Since a module in Python can be used as a dictionary of functions and classes, I was able to find what functions the library provided by importing it and looking at its contents. For each of the functions, the document string gave a one line explanation of how to use it.

    1. Re:Python's documentation strings by Wench · · Score: 1

      Ah, what joy, if only the code I'm working on had docstrings...

      BTW, there is Perldoc too. Once again you can choose to do good or evil in either language...

      --
      No matter how cynical you become, it's never enough to keep up.
  143. VA AND ANDOVER steal Money, CHeat Innocent people by Anonymous Coward · · Score: 0

    One of the most cynical deals recently involves the merger of two software companies trying to cash in on the Linux operating system craze: Andover.net Inc. of Acton, Mass., and VA Linux Systems Inc. of Sunnyvale, Calif.--which went public within 24 hours of each other back in early December. Less than eight weeks later, on Feb. 3, the two companies announced a stock-for-stock merger in which the California company has agreed to acquire the Massachusetts crowd for about 6 million shares of VA Linux and $60 million in cash. The cynicism in the transaction is not simply that the deal took place so shockingly soon after the two companies wrapped up their I.P.O.'s, but that the transaction included what amounted to a legalized bribe on the part of the VA Linux bunch to get the Andover.net crowd to accept the offer. The deal means that the $60 million in cash from VA Linux will go directly to Andover.net's shareholders, at $3.81 per share, in effect handing over the same amount of money Andover.net raised in the I.P.O. only weeks earlier. Prior to the I.P.O., the company's insiders had only paid a grand total of $15.7 million in cash into the company. Now they are being handed back $60 million as compensation. What a deal. As for investors in VA Linux, they are getting hosed. The company's stock was priced in the I.P.O. at $30 per share, but opened for trading at $299 and instantly shot to $320, then collapsed like many of the others and eight weeks later is now selling for $110. Faced with 39.7 million total shares outstanding already--of which only 4.4 million are held by the general public--investors in the stock can now look forward to the imminent registration of 4 million more shares by the company, which will doubtless come pouring into the market soon thereafter, thanks to the Andover.net deal. In other words, the only really valuable asset Andover.net ever had--its cash from the I.P.O.--was creamed off by the company's insiders almost the very instant they got their hands on it, leaving VA Linux's shareholders to face a 100 percent increase in the float of their own stock for the privilege of winding up with the worthless trash that the Andover.net bunch dumped at the very first opportunity.

  144. Re:Compiler-level optimization by Oniros · · Score: 1

    Right. And what I wanted to point out is that it's not because the code is longer/more readable that it's less efficient (I was arguing that python code could be optimzed and that its human readability and good structure can actually help the compiler at doing a good job.)

  145. Is ZOPE free software? by bartok · · Score: 1

    Can anyone tell me if ZOPE is free sorftware? I went to the ZOPE web site but there's no reference to a licence.

  146. Re:ML and Tuples by chris.bitmead · · Score: 1

    Someone correct me if I'm off track here, but FUNCTIONAL != DECLARATIVE. In SQL, you say nothing about how to achieve a result. In a functional language you still have to say exactly how to solve it, it's just that you avoid assignment as a tool to solve it (leading to a whole lot of benefits). Admittedly a pure functional program starts to show some similarities to declaritive (like saying n! = n*(n-1), but it's not quite the same thing).

  147. Re:How does Python deal with all types of whitespa by Rogain · · Score: 1

    The evil python god will appear and squeeze the life out of you!

    --
    The current Slashdot moderation system is made by gay communists!
  148. Re:Compiler-level optimization by chris.bitmead · · Score: 1

    As always, it still depends on how good the compiler is. If it can optimise common p-code sequences to a compiled solution, or do run-time java-type stuff, then you're ahead.

  149. Midgard as an alternative to Zope by PGillingwater · · Score: 1

    For those of us who have been working with Perl a long time, but like the idea of a strong Web content management system, there is an alternative to learning Python. Midgard is a powerful open-source Web content management system that combines MySQL and Apache with the scripting power of PHP3. Definitely worth checking out, if you can get through the challenging installation. (As a hint, try using the Monster RPM under Linux, it's much easier.)
    --
    Paul Gillingwater

    --
    Paul Gillingwater
    MBA, CISSP, CISM
  150. Re:ML and Tuples by David.O'Toole · · Score: 1
    In other words you still haven't told me about a "Procedural Language" (OOP or non-OOP), other than Python, that supports Tuples as first order constructs.

    Try C's "struct" keyword, or if you want it to be a little nicer, full classes in C++ ( if for nothing more than operator overloading.) If you really are talking about tuples in the mathematical sense, I think "struct" fits the bill. It just doesn't generally look like a tuple unless you are initializing it. C++ can fix this by overloading the function call operator.

    In any case the difference is syntactic.

    --
    GNU OCTAL http://www.gnu.org/software/octal
  151. Re: Perl/Python faster than Java (Wrong) by Baldrson · · Score: 2
    hardcored knowledge can't compete with flexible mind the same way, expert systems can't compete with real thinking person

    What percentage of programmers can really out-do an optimizing "C" compiler by writing hardcoded assembler given the time constraints under which they typically must complete projects?

    The fact is that modern optimizers are pretty damn good, and I say that as someone who wrote assembler code for Cray's CDC Cyber series to support 500 real-time graphics users simultaneously at 1/4 response time (Plato circa late 1970s -- about 1.5 million lines of COMPASS code written by the entire system staff) as well as tens of thousands of lines of assembler code for a multiuser BBS/Chat system with its own OS (FORA) that could support 32 simultaneous users on an 8MHz 8088 running at 2400bps flat out with 1/4 response time maximum.

    Come back when you've accomplished similar feats and we'll discuss just how optimal humans, operating under real world constraints can make assembler code compared to optimizing compilers of higher level languages.

  152. Python doesn't enforce OOP by acb · · Score: 2

    Unlike Java and its ilk, Python doesn't make you write everything as objects and methods. You can write scripts using only functions and control structures if you like. Though having classes for doing things such as HTTP, XML parsing, database access, &c., is very useful. Though if you're violently averse to OOP, you can ignore that completely.

    Unlike Perl, the syntax and implementation of the object-oriented features isn't hideous. Doing OO in Perl is only slightly less bogus than doing it in raw C with structs of function pointers. Much of this bogosity comes from Perl's crufty syntax when it comes to type-handling and declaration, which seems to have been (to paraphrase Douglas Adams) not so much designed as congealed. Behaviours and modes of usage were added as a series of afterthoughts, and hence, inconsistencies abound.

    And furthermore, Perl's lists aren't a first-class data type. Thus you cannot have a list of lists, only a list of references to lists, using the @ operator. Attempting to pass a list of lists to a function flattens them all into one list. The requirement to explicitly delve into language mechanics to get something as simple as a list of lists is not something you'd expect from a high-level language.

    I worked with Perl for several years, both professionally and on personal projects. After learning Python recently, I can say that I will probably never use Perl for anything more than a short throwaway hack, in its awk-on-steroids capacity. Several other programmers I know have reported similar experiences.

  153. Languages starting with 'P' considered harmful by Anonymous Coward · · Score: 0

    Seriously, I tend to skip all programming languages whos names start with a 'P'. Pascal? Python? Perl? PHP? Sorry, not for me. There is something strange about all programming languages starting with 'P'.

    'P's ASCII code is 120(oct), 80(dec), and 50(hex). All not serious numbers to me (pi is a serious number :-)) And in binary its code starts with 101. So are programming laungages starting with 'P' just for beginners?

    No, no. If you want to ensure that I don't use your language, give it a name starting with 'P'.

  154. Re:How does Python deal with all types of whitespa by Abigail-II · · Score: 2
    Python cares if you are consistent about it within the block. it does not have to be a tab.

    Well, yes, however, isn't one of the virtues of Python that it makes it easier to maintain other peoples code? It's easy for a single programmer to be consistent - but Python forces consistency (to some degree) upon you, to make it easier to work with multiple people on code. With multiple coders come multiple editors. With multiple editors come different ways of indentation. While most programmers will use editors that will automatically indent as much as the previous line (usually, some editors will extra indent if the previous line ends with an opening brace/paren, or a colon), but they aren't consistent on how to pad the new line. Some editors will only use spaces, other editors will use as many tabs as possible. And while on programmer has a tabstop of 8, another has it set to 4.

    Using a consistent indentation is good. But forcing it upon the programmer is, IMO, not the best solution. It's not necessary if there's only one programmer, and inconvenient when there are multiple programmers.

    OTOH, save of vertical space does have merit. I usually don't care much about it; it isn't too hard to live by, although it sucks if all you want to do is a quick cut-and-paste job. For me, it's not a reason not to program in Python.

    -- Abigail

  155. there's more than one way to do it..piece of sh%$! by Anonymous Coward · · Score: 0

    In their book "Programming Perl" larry wall and tom christiansen advises the readers on several "ways of making perl code easier to read,understand, and maintain"?? hehe.. They said, "just bcoz you can do something a particular way doesnt mean you should do it that way" well why did you make Perl the way it is in the first place????? some of the most esoteric feature of perl are now obsolete or is being changed and i bet some of them are going to be in the next couple of years. Thank gawd we still have the Bell Labs folks (Brian Kerninghan, Al Aho, Jon Bentley, etc.). Perl is bad...bad...bad...it'll be obsolete as soon as newer..more elegant language takes its place...like Python..hehehe

  156. Hi, kdart by Anonymous Coward · · Score: 0

    Scintilla is good with Python.

    http://www.scintilla.org/

    linux&win32 available!!

    your truly AC

  157. Download it here by spiralx · · Score: 1

    Try the Python Language website, here.

  158. Fourth version by Spiv · · Score: 2

    Actually, there is fourth version of Python: Stackless Python - a version of Python which doesn't use the C Stack.

    If you are wondering "Why?" right now, and the usual answer "Why Not?" doesn't satisfy, then the link goes some way toward explaining what the advantages are (specifically, much faster for some classes of problems).

  159. Re: Perl/Python faster than Java (Wrong) by warmi · · Score: 1

    You talking about writing entrire programs in ASM , I am talking about optimizing specific , usually small part of program. Of course compiler will do better job cause it can apply optimization to the whole program ... But it will never do a better job for something small and specific like transparent run-lenght encoded blit.
    Half decent asm programmer will always be able to roll faster routine simply because he knows more at the problem at hand than compiler does.

  160. Re:How does Python deal with all types of whitespa by gorilla · · Score: 2
    The problem is that now you only know what the program actually does, not what the programmer indended it to do. Anyone who's done any maintence programming will know that knowing what the program does is the easy part, finding out what the programmer wanted to do is the hard part.

    With most languages, the syntax tells you what the program does, and the indentation tells you what the programmer intended.

  161. Re:How does Python deal with all types of whitespa by gorilla · · Score: 2
    If you think that saving screen space is so valuable, why the blank lines between each paragraph? IfYouWantToGoToTheExtremeYouCouldEvenRemoveAllTheS pacesToo.

    The readable programs I see always include 'unneccessary' breaks between program sections, because it's actually neccessary to allow our brains to see patterns.

  162. close by raistlinne · · Score: 1

    Well, you're close, except it would be the serpent to break the silence. And he would get much more insulting, while the pearled monk would be much nicer. At least this is the trent I've noticed on slashdot.

    Perl people, believing that there's more than one way to do things and being adaptable creatures don't mind that python people use python at all. Python people, being something which forces them to try to convince the world that python is the way the truth and the light, do so.

    I don't know why this is so. I don't know why the python people seem to insist that because perl is a big langauge it's bad. I don't know why they think that having to learn perl to use it makes it a bad language.

    Perhaps python is a great language for beginners because it really forces them to do things that they should have learned anyhow. Maybe it's a great language because it doesn't differ from most other languages very much (this is usually called easy to learn). Maybe it's great because it's extremely inflexible because God talked directly to guido van rossam (sp?) and guido just wrote down the lines. I don't really know.

    I do know that I think that a very heavily OO approach to problems is putting the theory before the practice and being way too anal. I like perl's modules because they give you the flexibility of OO with the reduction in typing of OO without giving you the increase in typing of B&D OO.

    Besides, I can write a filter and then write very sloppy python code. If you need clean code, use strict and execute with -w. If you are stuck maintaining the code of someone who is sloppy and determinted to be so, your in trouble. Maybe python encourages writing clean code. So does perl -Mstrict -w when you get down to it. Probably more so. With the right packages installed perl will even check for Y2k bugs (a moot point nowadays).

    The closest theory that I can come up with is that there are probably a few really intelligent python programmers, and these people aren't zealots. There are hords of mediocre python programmers, and these people are zealots because they lack the ability to learn many languages, especially if some of those languages aren't minimalistic languages.

    As larry wall has said, there's more than one way to do it. Perl can be used to optimize for many different things. One of them is readability. There are readability flags in regular expressions, for crying out loud. Does python have /x (admittedly, not that I've ever used it, if you know regular expressions they're generally clear enough)? So if you want readable code, write it. Yes, this takes a bit of discipline. Big deal. Force all your programmers to use strict. Have them run with -w every friday for good measure.

    Do it how you want. I really just wish that the python fanatics would stop prattling that people need to be in chains before they'll be moral. In the end, that's why I'll never use python - any language whose main claim is to be nearly as good as perl but without any flexibility just isn't worth the time. I can go learn Alpha in binary if I really want minimum flexibility for maximum readability. Just think, only around 100 instructions to memorize and then I know the entire language! Just a few hours and I can read anyone's code and know instantly what it does!

    --
    They laughed at Einstein. They laughed at the Wright Brothers. But they also laughed at Bozo the Clown. -- C. Sagan
  163. Re:Please learn how a JVM works (no, you learn) by rambone · · Score: 1
    The Perl implementation uses a two-dimensional hashtable which requires an O(1) lookup to locate a prefix.

    All hashtables have unit time lookups. Crack open your undergrad text.

    Yeah, anyone who wants type safety is a idiot

    Then stay away from Java - the only way you're going to get useful polymorphism outside of templates (which Java doesn't support) is to excessively cast from base classes, perhaps as far up the tree as Object. Bye-Bye type safety.

    P.S. You're still wrong

    Blah Blah Blah...you STILL haven't provided me with one concrete unbiased performance suite that shows Java beating perl.

  164. natural and artificial langauges by betamax_ · · Score: 1

    People who think coding is engineering favor python. They want a large and structured language where they can talk about larger and larger concepts more efficiently. The example is object oriented lanuages like C++ that brought structure to another level. Soon there will be another generation of languages, probably based around design patterns, kind of like a meta-object language. However, if you're a perl type who considers coding an art form, you believe in small and versatile languages that can express things in multiple ways. This takes more of the approach of mapping the language to the problem space. I personally code far better the perl way. Although it may be called sloppy by computer science types it really is the quickest and most natural way to solve a coding problem, rather than building sealed off layers of code that an engineer just places together like interchangable parts.

  165. Re:How does Python deal with all types of whitespa by Baki · · Score: 1
    With multiple coders come multiple editors. With multiple editors come different ways of indentation.

    Using a consistent indentation is good. But forcing it upon the programmer is, IMO, not the best solution. It's not necessary if there's only one programmer, and inconvenient when there are multiple programmers.

    It is horrible to have multiple ways of indentation within one project in combination with version control tools. If you try to do a diff between two versions to see the differences, often you see 10% real diffs, and 90% where someone just changed the indentation (like Emacs with it's auto-indent-region). Thus it is great to force people within a team to use the same indentation conventions.

    The only thing that makes sense to me is to always use one tab for one indentation level. To how much space a tab expands, everyone can choose for himself (and doesn't affect the contents of the file).

  166. Rare species specimen here ! by ^BR · · Score: 1

    Seems that we just found the latest person on Earth not having ever heard of JIt compilation and Hotspot...

  167. Re:Please learn how a JVM works (no, you learn) by ^BR · · Score: 1

    Except they made Java both idiot proof and poorly performing by removing the virtual keyphrase. With Java you pay for a vtable whether you want it or not.

    Hum, and never heard of the final keyword as well... Why bother others if you really don't know anything about Java ?

  168. Re: Perl/Python faster than Java (Wrong) by Baldrson · · Score: 2
    Every JPython function is translated ultimately, to Java bytecode

    Java bytecode isn't Java -- it is an abstract high level assembler which is relatively language independent.

    Besides this, Python isn't much "higher level" than Java.

    The experience of my professional acquaintances who have worked extensively in both Python and Java (~100K line applications) tell me they can get the same job done in about 1/4 the number of lines in Python and maybe 1/5 the lines in Perl.

    These are guys who have been doing OO programming in Java's progenitor, Objective C, ever since the beta release of the NeXT cube and follow design patterns rigorously (as well as teach the subject on occasion).

  169. Re: Perl/Python faster than Java (Wrong) by Baldrson · · Score: 2
    Half decent asm programmer will always be able to roll faster routine simply because he knows more at the problem at hand than compiler does.

    There is evidence that using genetic algorithms, best practice human optimization of specific functions have been substantially beaten by machine evolved algorithms. Having used these optimization techniques in other systems myself, I find such claims plausible. It may be a while before sophisticated compiler optimization technology actually exploits JPython's higher level expressive power than Java and produces the faster JVM sequences for the same application, but the point is that arguments that this is impossible in principle are bogus. This is a little like the argument over whether machines will ever beat humans at chess. That argument has now been put to rest. Machines are routinely playing chess at Grand Master level. This isn't general artificial intelligence -- but it is usefully specialized "AI".

  170. Re:Please learn how a JVM works (no, you learn) by maraist · · Score: 1
    But you're wrong again. Perl typically executes faster on text processing benchmarks because of
    the builtin regexp. But you cannot conclude from this, that Perl is faster than Java per se. Perl is
    fast at what it does (and I speak as someone who has written over 100,000 lines of Perl code and
    have been writing it since 1991).


    I agree that mathematical algorithms are slower in perl. I too have written nested loops of matrix manipulations, and they were inexcusibly slow. Even when you specifiy integer only, and use for( 0..100) instead of for( $i = 0 ; $i ( notice my aversion towards the bastard word "proof" ).

    Perl is glue, and should be treated as such. You can't write big perl programs without having an intimiate understanding of C ( since you're bound to call a great many c-library functions, and you really should consider writing stuff in C in tandem ).

    In this respect, perl has the potential to be faster than Java for certain classes of projects. In general, an all native project will run faster in java IF, the delay in JIT ( or VM loading/ initialization for that matter ) compilation is marginalized away by either a sufficiently large computationally intensive core, or through persistent operation ( serverlet, etc ). Otherwise, gcc optimizations are bound to make better work of the perl-c libraries, than JIT will on the java-byte-code.

    In my experience, the load time of java applications is very frustrating. Perl has very little to initialize, and is single processed at that, so will run faster than java-native-threads for simple applications. Plus I rarely find a perl-daemon eating up 100% of my CPU time, which I have regularly found in java ( at least netscape's version of it ). As a disclaimer, these are _my_ experiences with Java, and I do not claim this to be the general case. I'm sure bad code design had much to do with it.
    --
    -Michael
  171. Re: Perl/Python different than Java by Edward+Kmett · · Score: 1
    I'd just like to amend a couple of your points: In partial rebuff to your first statement, I agree that Python is a hell of a lot slower than Java. JPython in my experience is about half the speed of CPython (Stackless or not). I had previously hoped that being able to leverage the JIT under JPython would gain me speed, but it proved not to. JPython is slower than CPython because it still has to do many dictionary lookups and it has to do those in java (well java bytecode).

    Python gets compiled down to bytecode just like java in both CPython and JPython. So does Perl for that matter. It can be JIT'd but no one has done so as of yet with pure python, and jpython w/ JIT is a bit unreliable as of yet. (The java bytecode comes out like a java compiler on drugs, and some JITs don't seem to like it all that well)

    JPython's speed hit over Java comes from the fact that it does name binding of everything at runtime, there is no concept of a final method, and everything has to come through a dictionary. Java can cache many of these things, but Python gives too much Smalltalk like message method handling controls for many of these facilities to work.

    And all of your endorsements for java double as endorsements for JPython. I can just as easily import the java library into my JPython app.

    --
    Sanity is a sandbox. I prefer the swings.
  172. Re:How does Python deal with all types of whitespa by Abigail-II · · Score: 2
    Thus it is great to force people within a team to use the same indentation conventions.

    I don't really agree that it is great, but Python is not helping you to force the same indentation levels throughout your program, let alone between versions.

    The only thing that makes sense to me is to always use one tab for one indentation level. To how much space a tab expands, everyone can choose for himself (and doesn't affect the contents of the file).

    Setting tab stops any other than 8 seems like a dumb idea to me. While most editors allow you to twiddle the length of a tabstop, other programs don't. Furthermore, there's no excuse of lines over 80 characters. But a twice indented line of 70 characters will fit in the 80 char limit if the tabstop is 4, while it won't fit it the tabstop is 6 or 8. Furthermore, it still doesn't solve the problem of some editors using leading spaces and others leading tabs on auto-indented lines. It just makes the problem worse.

    IMO, the only "rule" that makes sense when it comes to indenting styles is: no tabs, ever.

    -- Abigail

  173. all hail code goddesses by Anonymous Coward · · Score: 0

    I think I'm in love.

  174. Re:Cool! by alangmead · · Score: 1

    No, as the web page I referenced before explained, Byte still had a reader base, and the group was as varied as it always had been. The varied readership made it harder to attract advertisers who wanted a focused audience. If an advertiser was selling Windows productivity software (sic.), they wanted "a Windows Magazine". If they were selling chips, they wanted "an Embedded Designer Magazine". etc.

    They had too few advertisers, not too many.

  175. Re:BYTE is still around?!? (yes and no) by Lansdowne · · Score: 1

    The paper version of the magazine died a while back, but shortly afterward it was reborn and re-cast as an online mag (BYTE.com).

    --
    Lansdowne
  176. Re:How does Python deal with all types of whitespa by Drinky+Crow · · Score: 1

    I disagree.
    The intent is fused with the actual performance.
    How can you suggest that having two channels that can be desynchronized is a good thing?

    --

    dook, dook, dook!