Slashdot Mirror


Mark Lutz on Python

Betsy Waliszewski sent in this interview with Mark Lutz, author of Programming Python. He discusses the evolution of Python during its brief history, XML support and .NET, and takes a brief look at the future of Python.

108 comments

  1. Re:Why hasn't Python taken off? by Anonymous Coward · · Score: 1

    Python is very powerful - it's killer app is Zope. Zope Makes PHP, Mod Perl and just about every commercial application server out there look *very* lame.

  2. Python is like toilet paper! by Anonymous Coward · · Score: 1

    I like to think of python as toilet paper -- I mean this in a good way, mind!

    After all, where would we be without toilet paper? Such a world scarcely bears thinking about. Yet for a great many years (up into the industrial age) it simply hadn't been invented.

    The march of technology is gradual, and the uses of a product are not always immediately evident. Paper itself had been invented centuries earlier by the Chinese, yet it wasn't until the time of the great Thomas Crapper that it could reach its full utilisation. Use of paper in an old-fashioned privy would have been disgusting and ridiculous. But in a water-based toilet, it is heaven on earth.

    Python is in much the same position. It is truly a splendid language, with features (e.g., whitespace formatting and garbage collection) that have been maligned in the past, and with good reason I might add. But hardware capabilities have moved on, and these are no longer liabilities, but features. Python is elegant, simple, safe, and above all it gets the job done. Previous tools could do the same work, but not nearly so comfortably.

    (And where does perl fit in to this analogy, perhaps you ask? Well, you see, the Japanese used to have use a thing called "the toilet stick"...)

  3. Python Queue ? Easy by Anonymous Coward · · Score: 1

    $ python
    >>> import Queue
    >>> q = Queue.Queue()
    >>> item1 = ["this","is","a","list"]
    >>> item2 = "now a string"
    >>> item3 = 3
    >>> q.put(item2)
    >>> q.put(item3)
    >>> q.put(item1)
    >>> q.get()
    'now a string'
    >>> q.get()
    3
    >>> q.get()
    ['this', 'is', 'a', 'list']
    >>> q.qsize()
    0

  4. Re:My Guess by Anonymous Coward · · Score: 1
    Nope, programming in Python is FUN. Programming in perl is torture. I *hate* producing read-only code. I *hate* working in big languages. I like taking small systems and building big things with them. Perl's syntax is just too awful.

    Python is fun because you can write very useful, complex, and READABLE programs very quickly. The startup curve with Python is extremely small compared to other languages, which is great.

    A professional programmer cares about the quality of his/her code and the people who come later who have to maintain it. Code which isn't maintainable might as well not have been written.

  5. Re:Why hasn't Ruby taken off? by Anonymous Coward · · Score: 1

    When I think of a cleaner Perl alternative, my thoughts switch to Ruby (not Python) as well. The main reason Ruby hasn't taken off is that all of the docs were, until the last couple of years, written in Japanese.
    Now that there is a good english Ruby book and apparently another on the way from O'Reilly that's changing.
    BTW: In Japan, Ruby has taken off.

  6. Re:so there, mikey, you been deleting posts agian? by Anonymous Coward · · Score: 2

    "C'mon, they're using MySQL. Were you really expecting there not to be massive data loss?

  7. Re:I agree totally. by Anonymous Coward · · Score: 2
    Or even easier:

    mystack = ['blaad', 'test', 'new']

    # pop
    poppedvalue = mystack.pop()

    # push
    mystack.append('new element')

  8. The Mark Lutz Impediment Factor... by Anonymous Coward · · Score: 4

    is the #1 reason python has not completely replaced other scripting languages as the preferred choice. His books are awful. I can only conclude that Mark wrote these books because he is secretly a perl zealot. He felt threatened by python and decided to write books to impede the collective python learning process. For now, stick with the docs at http://www.python.org

    1. Re:The Mark Lutz Impediment Factor... by ntk · · Score: 2

      Troll or not, I think there's an important point here. People's impression (and use) of a language is *hugely* influenced by the tutorials they use.

      I think that most people's impression that Perl's OOP features are a bit convoluted comes from their slightly tacked-on explanation (in terms of previous Perl features) in the Camel books. Given that most approaches to large-scale projects revolve around OOP these days, that leads
      to people using the wrong techniques with Perl, and getting unmanageable stacks of steaming subs.

      Damian Conway's Object-Oriented Perl, on the other hand, is so good that it won me back to Perl from Python. Conway's explanations show you the subset of "ways to do it" that include "ways that scale".

      It was a bit of a relief, to be honest, because while programming Python felt very worthy and clean, it was not fun. I wonder how much that had to do with how I learnt it too?

    2. Re:The Mark Lutz Impediment Factor... by muwahaha · · Score: 1

      "Learning Python" is much better, imo, though by
      the time it came out I couldn't learn much from
      it, so I don't know how it would look to a
      beginner.

      Alex.

    3. Re:The Mark Lutz Impediment Factor... by zephc · · Score: 1

      i learned python from the docs on python.org and i'm happy... i'm too cheap to buy a manual for a language as easy as python =] Perl, OTOH, is a language where several books are handy, often necessary.

      -----------
      MOVE 'SIG'.

      --
      "I would say that 99 per cent of what my father has written about his own life is false." - L. Ron Hubbard Jr.
    4. Re:The Mark Lutz Impediment Factor... by Einziger · · Score: 1

      Cool so I'm not the only one that thinks this book should be verboten. I mean I was actually pretty lucky, the book cost 40 dollars, but I somehow got charged 5 dollars at Borders. Maybe they knew how sorry the book is and had some sympathy for me LOL. Can anyone recommend a real python book for me?

  9. Re:OK, I'm lazy by Ian+Bicking · · Score: 2
    In all truthfullness, you shouldn't: Java is faster than Python, and servlets kick ass.
    Java probably is faster than Python, but that should seldom make a difference. Add a few processors, whatever. The database is where you should be doing most of the heavy lifting anyway.

    Webware gives you servlets in Python. I would recommend it -- Zope isn't by any means the only way to use Python on the web (thankfully).

    I've never used Java servlets, but I've read a few bits of sample servlets. They seem to me to be painfully verbose. I'm all for long variable names and all that jazz, but Java just seems to make you jump through hoops for no good reason. It's not just that it isn't fun, or requires lots of typing, but verbosity makes for a bad language. You should be able to say things as you mean them, verbosity obscures that.

    However, Java may not be so bad on a larger scale. Perhaps the example code doesn't want to build even a small library (since its just an example) and in a real project you'd do that and simplify things.

    Another thing I like about Python is the extremely dynamic nature. You can have a dynamic inheritance tree, for instance -- consider an entire framework where you could subclass major components and those subclasses can easily insinuate themselves into the depths of the framework. This allows you to make radical changes to the framework without compromising the distinction between your local code and the upstream code. To do this requires that classes be first-class objects, so you just can't do it in Java.

  10. Re:Python and Smalltalk by Ian+Bicking · · Score: 3
    I think it is mostly due to issues of deployment. Python's biggest gain has been that it is now pretty ubiquitous on modern Unix installations. It's also pretty easy to install on Windows. Most Unix web hosts have it installed. Etc.

    This hasn't and isn't going to happen for Smalltalk. There's no clean, well-partitioned way to install a Smalltalk runtime. It's overintegrated and overly insular. So it can't come in slowly, with small programs and utilities being written in Smalltalk.

  11. Re:Python and Smalltalk by dangermouse · · Score: 1
    I took a class in software design where Squeak was used, so I think I can answer this. Smalltalk is horrible.

    Previous posters have already mentioned the "wall" between the environment and the host system, and while I can understand the reasoning behind it, it is dated reasoning.

    The bigger issue I have with Smalltalk (or perhaps just with Squeak) is that there is no syntax. Everything is an object, including such tradition keyglyphs as '='. That's swell, except that it means syntax is defined wholly by the object in question. Various classes had their own ideas of how they wanted their parameters arranged when they were instantiated or their methods called. It was horribly inconsistent. I spent more time reading "library" code in that language than I have in any other, and I remember almost none of it because it was so often conflicting.

    It was a cute idea... pure OOP from the ground up. But it sure did turn into a nightmare.

  12. review of Programming Python by danny · · Score: 2
    --
    I have written over 900 book reviews
  13. Python - Objective-C Bridge by Colin+Simmonds · · Score: 1
    My question is, is there any kind of plan to do the same kind of thing for Objective C and the Cocoa (NextStep) and/or GNUStep APIs? If not, would it be feasable, or maybe even productive, to do so as a third party hack?

    Check out the Python - Objective-C bridge project at Sourceforge. It appears to be coming along slowly. In the mailing list archives you'll also find discussion of using Jython with Apple's Java bridge as well.

  14. A few quick changes by crisco · · Score: 2
    to his weighting and Python suddenly comes out near the top. And thats without trying, just dropping some ones in the LOC & memory boxes.

    seriously, use what works best.

    Chris Cothrun
    Curator of Chaos

    --

    Bleh!

  15. Re:Why hasn't Python taken off? by Jonathan · · Score: 3

    Well, Python is in an awkward position right now -- it isn't the newest and coolest scripting language anymore -- that's Ruby these days, and at the same time it isn't the standard scripting language (which is still Perl). Without the coolness factor it had in the mid '90s, Python's hope for growth lies in people hired to maintain code written by the first generation Python hackers, and this means slow (if steady) growth.

  16. Re:needs a Perl Journal equivalent by Zagadka · · Score: 1

    for no other reason that when I'm 5 levels deep and want to write something like someProperlyAndDescriptivelyNamedVariable = somObjectWithAnotherLongAndDescriptiveName.aMethod WithSimilarlyLongAndDescriptiveName(someObviouslyN amedParameters,someOtherObject.someOtherMethod()); it's running off the side of a normal xterm real quick

    You know that Python lets you put parens around an expression, and then have the expression span multiple lines, right? eg:

    someProperlyAndDescriptivelyNamedVariable = (
    somObjectWithAnotherLongAndDescriptiveName.aMethod WithSimilarlyLongAndDescriptiveName(
    someObviouslyNamedParameters,
    someOtherObject.someOtherMethod()
    )
    )


    By the way, the trailing semicolon is unnecessary.

  17. Re:Why hasn't Python taken off? by Zagadka · · Score: 1

    So you've got your editor configured incorrectly. Set your tab width to 8. Then you'll be seeing what Python's seeing.

  18. Re:Why hasn't Python taken off? by Zagadka · · Score: 1

    Python has taken off. Yes, less people use Python than use Perl. But less people use Linux than Windows. The difference is between the people in the know, and the unwashed masses... :-)

  19. Re:Why hasn't Python taken off? by FFFish · · Score: 2

    The whitespace thing is pretty easy to deal with; simply be consistent. Python doesn't care if you use tabs or spaces, and doesn't care how many tabs or spaces you use, *as long as you're consistent.*

    There are a few utilities to check your source for proper indentation, or to convert tabsspaces.

    And the major macro-programmable editors all have hacks that let them deal very intelligently with whitespace, including automatically indenting at appropriate times.

    Plus there are a few Python-specific editors, that also do code-colouring and such.

    All in all, FeErOfWhItEsPacE is silly.

    What's the problem with lists? How would you want to write them??

    --

    --

    --
    Don't like it? Respond with words, not karma.
  20. Re:Why hasn't Python taken off? by FFFish · · Score: 4

    Well, now, let me just rip this off directly from a Python website (http://www.python.org/psa/ Users.html). And there was a recent thread in the Python newsgroup, mentioning about a dozen more big names.

    Thing of it is, Python does what it does so well that no one notices it.

    It's like when you walk into a retail store. You don't notice that the carpets are clean. The carpets don't call attention to themselves. They're just *there*, doing their job.

    Only time you notice a carpet is when it's filthy. When its syntax is filled with !@$% symbols. When it has memory leaks. Etc.

    Anyway, the shortlist of companies using Python in commercial apps:

    Advanced Management Solutions Inc.
    * AMS provides the AMS REALTIME suite of enterprise software for project management, resource management, cost management and timesheets. The Python language engine is embedded in AMS REALTIME as a means of extending the products, and also as a way of enabling custom behavior and company-specific business rules to be supported.

    CWI
    * CWI, Python's home, has used Python in, among other things, GrINS, a 20,000 line authoring environment for transportable hypermedia presentations, and a 5,000 line multimedia teleconferencing tool, as well as many many smaller programs. See the collection of multi-media project papers.

    Digital Creations
    * A long-time sponsor of the PSA, Digital creations develops with Python - and also makes some of their Python software available for free!

    ILU
    * ILU (it's spelled Inter-Language Unification but it's pronounced eye-loo) is a (very) CORBA-ish multi-language object interface system. It has bindings for Common Lisp, C++, ANSI C, Modula-3 and Python.

    Automatrix
    * Musi-Cal(tm) is the first online calendar that provides easy access to the most up-to-date worldwide live music information: concerts, festivals, gigs and other musical events. It is maintained by Python scripts. So is their Internet
    Conference Calendar.

    Nightmare Software, Inc.
    * Nightmare Software builds 32-bit Windows software with Python - and gives some away!

    Infoseek
    * Ultraseek Server, Infoseek's commercial search engine product, is implemented as an elaborate multi-threaded Python program with the primitive indexing and search operations performed by a built-in module. Most of the program is written in Python, and both a built-in spider and HTTP server can be customized with additional Python code. The program contains over 11,000 lines of Python code, and the user interface is implemented with over 17,000 lines of Python-scripted HTML templates. Try it out on the Python.Org web search page or download an evaluation copy from Infoseek Software.

    eGroups.com (previously Findmail)
    * A comprehensive public archive of Internet mailing lists, implemented in pure Python. Latest statistics from Scott Hassan: 180,000 lines of Python doing everything from a 100% dynamic website to all email delivery, pumping out 200 messages/second on a single 400 MHz Pentium!

    DataViews Corporation
    * DataViews Corporation in Northampton, Mass., have been using Python internally quite a bit.

    LLNL
    * A group at the Lawrence Livermore National Laboratories is basing a new numerical engineering environment on Python, replacing a home-grown scripting language of ten-year standing. Paul Dubois is a central figure in that effort.

    NASA
    * Johnson Space Center uses Python in its Integrated Planning System as the standard scripting language. Efforts are underway to develop a modular collection of tools for assisting shuttle pre-mission planning and to replace older tools written in PERL and shell dialects. Python will also be installed in the new Mission Control Center to perform auxiliary processing integrated with a user interface shell. Ongoing developments include an automated grammar based system whereby C++ libraries may be interfaced directly to Python via compiler techniques. This technology can be extended to other languages in the future.

    IV Image Systems AB
    * IV Image Systems uses Python for many projects, including a satellite image production system for the Swedish Meteorological and Hydrological Institute (SMHI) (see next entry).
    This system receives raw data from several weather satellites, and produces images for many purposes, including the satellite images used for the presentation of the daily weather on Swedish TV 4.
    For more information, contact Goran Bondeson.

    Swedish Meteorological and Hydrological Institute
    * SMHI is the home of the Swedish civilian weather, hydrological and oceanographic services. It's Python-based remote sensing software for automatic product generation, using NOAA and Meteosat data, provides information to bench forecasters, objective analysis schemes, and commercial interests such as the media. At SMHI's Research & Development Unit, a Python-based "Radar Analysis and Visualization Environment"


    --

    --

    --
    Don't like it? Respond with words, not karma.
  21. Re:Why hasn't Python taken off? by Laxitive · · Score: 5



    I think you're underestimating the popularity of python. Python still has to ramp up a decent 'community module' system like perl has. Check out 'the Vaults of Parnassus' (google is your friend). It has not existed for too long, but there's a good set of useful modules there.

    The fact is, when you see python, there is'nt "one magic application" that suddenly jumps out as "the perfect thing" to use python for. I think that's because sucn an application does not exist. Python is a bit like C - it's an extremely good general purpose programming language that does a lot of things well.

    C is a simple, efficient, fast and portable low-level language for doing generic system programming.

    Python is a simple, object oriented, modular, clean language for doing generic application programming.

    Have you ever tried to do a large-scale project in perl? Something with a few ccomplicated nested data structures, a multiple threads modifying the same data model, some serious io handling? All of that rolled into one farm fresh breakfast unit. It's hard to do in perl - because perl was not designed with such uses in mind. It'd be LONG and annoying in C, because BSD sockets are a pain to work with, and C generally makes many things long and tedious (if you want to do them "right" anyway). C++ would be quite a bit better than C, but you'd still have to deal with the C system APIs, which will still be annoying. Java would probably give you quick development cycles, but nowhere near as quick as python.

    I consider python as lying somewhere in between scripting languages and compiled languages. It lets you do structured programming and gives you a powerful OO structure and modules galore, but keeps the syntax simple and clean. To me, it's a lot closer to Java than Python (this stand is supported a bit by Jython).

    It fulfills the 'glue' properties more than perl does for me. I see perl as sed with better syntax and modules (and I like perl, and use it quite a bit, dont get me wrong). Python is something you can use to quickly and painlessly write good, maintainable, modular, portable code.

    -Laxitive

  22. Re:Why hasn't Python taken off? by raistlinne · · Score: 1

    "Only time you notice a carpet is when it's filthy. When its syntax is filled with !@$% symbols. When it has memory leaks. Etc."

    Wow, you don't know much about rugs, do you? You also notice rugs when they're especially pretty, or contain interesting patterns, or tell great stories succinctly, such as s|\W|sprintf("%%%x", ord($1))|ge.

    Btw, are you really implying that noone who programs with python actually notices the language? That they just subconsciously add in the name of the interpreter in the #! line at the top of the program, without it ever occuring to them that when they type "#! /usr/bin/env python" they don't actually realize that that means that the python interpreter is going to run. That you never have to look up a function? That you never make syntax errors?

    --
    They laughed at Einstein. They laughed at the Wright Brothers. But they also laughed at Bozo the Clown. -- C. Sagan
  23. Re:from future import ruby by HiThere · · Score: 2

    The license is causing me to look at Ruby. I don't like having the license specify that a UCITA state controls what the license means.

    Caution: Now approaching the (technological) singularity.

    --

    I think we've pushed this "anyone can grow up to be president" thing too far.
  24. Re:Python vs. Ruby anyone? by HiThere · · Score: 2

    I like Ruby better as a language (I prefer braces, e.g.). But Python is better developed, and has a larger library, and has more documentation.

    It all depends on what you want to do. Certainly if it's something that someone has already written the code for, then Python is more likely to have it pre-done. Also, many more systems come with Python already installed. And Python has a freeze system for packaging up a program into an executable for distribution. I've not yet used it (I tend to drop into Ada or Eiffel if I want a compiled module), but it's there.

    OTOH, Ruby currently seems to be changing faster than Python. I suspect that this is largely importation of stuff from Japan, where Ruby originated, but the effect is the same. Still, there is currently only one book on it (though another [by Matz] is on the way).


    Caution: Now approaching the (technological) singularity.

    --

    I think we've pushed this "anyone can grow up to be president" thing too far.
  25. Re:Why hasn't Python taken off? by Rainy · · Score: 1

    I'm a python newbie, so take this with a cistern of salt:

    Python is good for almost anything, but it's particularly good for studying programming, prototyping and as a 'glue' language. Let's rephrase the question, however to 'why hasn't it taken off more spectacularly?', because it is really quite popular and widely used, just not as much as perl or java. Now, when people are picking their first language they will often pick the one that's the most 'marketable' like C or java or perl. They don't understand why a good glue or prototyping language is important, and naturally they don't want to study language that's good for studying, they want to study a language that's good for doing something they need done. In my opinion, perl gives you an opportunity to do some really powerful and exciting things real quick, sacrificing some readability, maintainability and consistency in the process. On the other hand, newbies will find out that winamp, napster, etc are written in c++ and/or c and will prefer to study that, because of familiarity. And lastly, a language that
    really shines at prototyping and 'gluing' will have inherently lower visibility than other languages (undeservedly, imho). All these things considered, it also surprises me that python isn't more widely used. Is this the dreaded 'worse is better' law at work? Are many people bugged by indentation syntax? I don't know, perhaps someone who tried it and decided against using it can share his reasons?

    --
    -- ATTENTION: do not read this sig. It doesn't say much.
  26. Re:Why hasn't Python taken off? by Rainy · · Score: 1

    I ran into this problem once, but it's not a big deal: it's trivial to convert tabs to spaces in any decent editor. I think the enforced readability advantage is well worth it.

    --
    -- ATTENTION: do not read this sig. It doesn't say much.
  27. Re:Why hasn't Ruby taken off? by Rainy · · Score: 1

    I looked at it but didn't like %&$'s - the whole reason I use python is clean syntax (well, the main reason, anyway).

    --
    -- ATTENTION: do not read this sig. It doesn't say much.
  28. Re:My Guess by Rainy · · Score: 1

    Python's fun to me, personally. I can't agree with 'dirty is good' concept, either - I prefer clean code, even when it's a 5 line script.

    --
    -- ATTENTION: do not read this sig. It doesn't say much.
  29. Re:Why is code readability such a big deal? by Rainy · · Score: 1

    Well, what about different bracing styles? Not to mention braces adding clutter and taking up precious lines :-).

    --
    -- ATTENTION: do not read this sig. It doesn't say much.
  30. Re:Why hasn't Python taken off? by platypus · · Score: 3

    ... and it's used in ESR's CML2 the new kernel config system to come in 2.5.

  31. Re:Why hasn't Python taken off? by Ambassador+Kosh · · Score: 3

    I think many overlook it not because it is not used as much but because no one makes a big deal out of its use. Zope is a good example of this. It is used in some very large organizations and it is a very powerful product. Many still confuse it with a web server though when in reality that is only the smallest part of its capabilities. What it really is good for is publishing python objects to the web, other servers via xml-rpc and other number of other things.

    I know a lot who use python because it gets the job done cleanly and efficiently however they rarely make a big deal out of which tool they used and most don't care what the solutions was coded in since it works pretty much without fail. Kind of how some people don't know their servers run unix because they have never had a need to know but everyone who has a windows server pretty much knows it because the server calls attention to itself.

    Do to the structure of python code tends to be designed rather then hacked together which in the end gives better running programs that have fewer bugs and are more modular, thus easier to fix and extend.

    --
    Computer modeling for biotech drug manufacturing is HARD! :)
  32. Re:Python is silly ... by eddy+the+lip · · Score: 2
    Seriously, Perl is a two dollar whore when it comes to syntax, but that's a good reason to keep coming back.

    heh. That's one of the funniest descriptions I've heard of perl yet.

    I love perl too (and I'm anxiously looking forward to Perl 6, which will hopefully have some of those shiny OO enhancements I've been craving. Alot of my scripts end up in that paradigm, and I'd love a few of the things mentioned in Apocalypse 2).

    I've started picking up python finally, mostly because of jython. I'm planning on moving to JSP and servlets for web development, and the thought of being able to prototype quickly in python, and have two languages to choose from depending on need is awful appealing. More, I have a lot more confidence in training people in a bit of python than a bit of java, if need be.

    That said, I don't think I'll be giving up perl anytime soon. It's a powerful language, and I like how obvious it is that it was developed by a linguist. It maps well to my brain. You can do amazing things with perl, in a very short development cycle, and with a bit of discipline, produce code every bit as maintainable as any other language. (sloppy perl coders have just been giving the rest of us a bad name).

    To be honest, the biggest reason I haven't picked up python sooner is the rabid python evangelists. God, they're annoying. It's a language, not the holy grail. Get some perspective.

    Conclusion? Different tools. I'm glad there's python. I'm glad there's perl. One's not going to be suddenly displaced by the other. I sort of think of python as the brazen adolescent, trying to figure out where it fits in, and pushing at it's elders. It will settle down, and be useful for a long time to come, I'm sure.

    That was a bit of a rant, but I feel much better getting it off my chest.

    - eddy

    --

    This is the voice of World Control. I bring you Peace.

  33. an interesting take on python by larry_h · · Score: 2
    the ai guru peter norvig has an interesting comparison between common lisp and python on his website.
    it's quite favorable and puts things in a nice perspective. not all languages make it past a comparison with one of the coolest language on the planet.

    check it out at http://www.norvig.com/python-lisp.html

    /largo

    1. Re:an interesting take on python by oodl · · Score: 1

      I'm currently doing a cross-platform project in Python with PyQt. Compared to C, C++, and Java, Python is cool and a pleasure to use... but language-wise, it's not on the same level as Dylan (one of the languages that Norwig compares). Dylan is considerably better designed and more powerful... and Dylan has real compilers. If Dylan has cross-platform GUI libraries, I would definitely be using Dylan.

  34. Re:Why hasn't Python taken off? by Corvus · · Score: 1

    > Yes, there are modules out there, but nothing like CPAN or gamelan or even MFC/C++
    > codeguru.

    It should be noted that Python comes with a whole heck of a lot of useful modules, so out of the box, there isn't as great a need for an external module archive such as CPAN. However, Python folks are working on a CPAN-like collection for Python too. See Python's Catalog-SIG.

    For what you get in Python, see its Global Module Index. You'll see why they say 'Batteries Included'.

  35. Man, you hit the nail on the head. by Pengo · · Score: 4

    He might be a great advocate, but lord.. probably the only Orielly book i felt cheeted on. (Maybe the only other one of from ORielly would be mastering TSQL) :)

    *Sigh*


    --------------------
    Would you like a Python based alternative to PHP/ASP/JSP?

  36. Re:My Guess by gsherman · · Score: 1

    Enjoyable to write Python code?

    Yes -- it's clean and explicit, which means your eyes won't glaze over when you revisit it a week/month/year hence.

  37. Re:I agree totally. by costas · · Score: 2

    Hmmm... Stack in Python... really hard... mind boggles:

    Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on win32
    Type "copyright", "credits" or "license" for more information.
    >>> z = [1, 2, 3]
    >>> z.append(5)
    >>> print z
    [1, 2, 3, 5]
    >>> print z.pop()
    5
    >>> print z
    [1, 2, 3]
    >>>

    In all truthfullness though, the book does suck... I like "The Quick Python Book" much better. And the html manual kicks ass... and there's always doc strings!:
    >>> dir(z)
    ['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'so
    rt']
    >>> print z.append.__doc__
    L.append(object) -- append object to end
    >>>

  38. Re:OK, I'm lazy by costas · · Score: 2

    In all truthfullness, you shouldn't: Java is faster than Python, and servlets kick ass.

    But say you wanted to be able to extend your servlet code, poke at live servlets, or get a lot of 'dirty' information out quickly (quickly as in development time). You can go to jython.org and grab a fully compliant Python interpreter implemented in Java. Presto, you got yourself a 4GL over your Java code. You can go google for JPE, a Java-Python bridge and go load Python extensions in C/C++ (much easier, IMHO than JNI) and talk to Python from Java and vice versa. Both Jython and JPE allow you to extend Python from Java and vice versa. That kicks ass...

    Java has its place (that layer of apps just above C/C++) and so does Python (the layer on top of Java). The really great thing is that you won't have to switch mindsets. Python is clean, consistent, and really, really easy to write (much more so than Java, again IMHO).

    Again, IMHO, I'd much rather prototype code in Python, work on the design, see what my design is missing, where I have to plug holes, and I can do so really quickly and easily (Python allows you to be more dirty than Java; multiple inheritance, writeable namespaces, exec(), etc...) and then I can profile the code (profiler comes with the std library) and extend the performance-bound parts in C/C++, again very easily. NumPy for example includes all of LINPACK: you get really great C/Fortran speed in numerical functions, but you get to use a RAD language.

    Try it, you'll like it. Damn, that should be the Python slogan :-)...

  39. Re:My Guess by costas · · Score: 2

    Man... I love writing code in Python... it is fun as hell (OTOH, I also write awk, ksh, a coupla obscure SPLs you never heard of, so it's probably a bad comparison :-). And the truth is, you can be "dirty" in Python: do things the quick and easy way, instead of the proper OOP way. But, python allows you to quickly read even through bad code. And its ability to be dirty allows you to refactor such bad code easily.

    Always, always, good code comes from good coders. A good language though, a) doesn't throw away the key of what the code does *cough*Perl*cough*, and b) allows you still enough flexibility to fix code, hack things together fast, etc *cough*Java*cough*.

    Don't expect all of Perl's bells and whistles in Python: Guido doesn't want to pollute the language with equivalent ways of doing things, which makes perfect sense to me: helps readability, and forces everybody to strive towards increasing performance and features in the same 'niche' of code. But there's also *plenty* of power in the language and there is a very big toolset to work from...

  40. Re:Why hasn't Python taken off? by costas · · Score: 3

    Let me add to the list a 3,000 line package written in Python by yours truly that wraps around Microsoft Visual SourceSafe so that VSS can be used by Unix clients (python CGI talking to a python client script).

    If anybody's interested I can put the source up for everybody to see/use (no docs though :-)...


  41. Re:Python is silly ... by MadAhab · · Score: 1
    Acutally kind of interesting. The only thing funny is that java always hits the same marks on your memory usage. That indicates a shortcoming in the methodology - probably JRE defaults. I am surprised to see it do so well on CPU usage, though.

    My personal experience is that Python is also CPU hog, although fast, for all that.

    The point being, you might find really different results depending on how hard you stress certain things. And once you find resulting bottlenecks, you [should] start optimizing. So even pretty good comparisons can be made very questionable in the hands of good programmers and administrators.

    <flamebait>
    On the other hand, Python makes the "whitespace overloading" hoax seem plausible.
    </flamebait>

    Seriously, Perl is a two dollar whore when it comes to syntax, but that's a good reason to keep coming back. Perl works better for me for many things. Its poor performance on object creation, method invocation, and some other areas was interesting. If Perl had good OO, it would be a lot better for certain kinds of use... and under sustained use (where startup costs are more negligible) I have found it to be extremely fast (e.g. under mod_perl).

    This post is illegal.

    Boss of nothin. Big deal.
    Son, go get daddy's hard plastic eyes.

    --
    Expanding a vast wasteland since 1996.
  42. Re:OK, I'm lazy by Orkin · · Score: 1

    Pro 1: One big benefit is its ease in debugging.

    Pro 2: It's easier to write than Java (well, for me, anyway)

    Con: If you don't know Python yet, a "huge" project isn't exactly where I'd start...

  43. In my modest experience... by Orkin · · Score: 2

    I find the old "Perl vs Python" battle a bit tiresome. While reading the article, though it hardly touches on Perl, I KNEW it was just bait for battle.

    I don't think that his book was bad (I've read it). I think Python rocks. I don't know very much Perl, but we use both extensively at work and I can see that they each have their strengths.

    On a positive note, I wrote my entire website (and I suck at site design, I know...) in Python, and it was (and still is) quite a fun project.

    Just my $.02. Flame away, please.

  44. Re:Why hasn't Python taken off? by stevey · · Score: 2

    I can code well in several languages/environments, including C/C++, perl, Emacs Lisp, Java, x86 asm etc.. up until very recently I've ignored Python completely.

    Once you know one language its easier to pick up another, however when you get to point when you can program in four, or five, you wonder what the point of learning another one is.

    Anyway, I've just been trying to find a web-based jukebox for a large MP3 collection - and the best one I could find, (that didn't need a database or anything fancy), was Edna - and lo, and behold, it was written in Python.

    After looking over the 300 lines of code that implements a webserver, a jukebox, and playlist generator I'm now increasingly tempting to learn more ... if only I could get my head round the way lists are written, and the whitespace thing...


    Steve
    ---
  45. Re:Python and Smalltalk by KurtP · · Score: 1

    I can give you _my_ opinion. I was doing commercial work in Smalltalk back in 1982, at Xerox. It was heavenly! Great development tools, a really easy to program GUI, and a powerful language with extensive libraries.

    Smalltalk's biggest problem, though, was "the wall" that the language put up between itself and the operating environment. Whenever you had to interact with something outside of Smalltalk, it was extremely painful. I think it eventually killed the language as a serious contender.

    The "wall" wasn't there because the language designers were silly, by the way. It was a response to the fact that in the 70s when a lot of the Smalltalk thinking was being done, different OSes were really, really different. Smalltalk was portable because of "the wall", which was a big win. Today, the various OSes are much more similar, and the choice doesn't look as great.

    By the way, Squeak, the successor to Smalltalk, looks very good. It still has "the wall" though, which is why I don't spend more time with it.

    Kurt

  46. Python hasn't taken off? by KurtP · · Score: 5

    Where have you been hiding? Python has gotten pretty interesting, especially the nifty stuff you can do with Zope and Numeric Python. As for a CPAN equivalent, you may want to check out the Vaults of Parnassus at http://www.vex.net/parnassus/

    For a language that hasn't taken off, there's a lot of stuff to be enjoyed (over 900 goodies at VoP last time I checked). Nifty net stuff, interesting numerics, GUI systems, sound and graphics libraries, and so on. Not to shabby.

    I used to hack a lot more in Perl, but it got to the point where I do anything more than a few hundred lines in Python instead. It's just a lot easier to get it working and keep it working in Python.

  47. Re:Why hasn't Python taken off? by smallpaul · · Score: 2

    Python has not "taken off" as Java did or Perl did in their day because it is not synonymous with an exciting new platform like applets or CGI. Not that applets or CGI matter today but they were neverthless great publicity for those languages.

    Python is too general purpose to get attached to any particular niche like that. It is just a little bit better for most taks than most of the competition. If you don't believe me you'll have to try it out yourself.

  48. Re: The Wall by timcuth · · Score: 1

    I was a Smalltalk (VW 2) programmer in '94-96 and I totally agree. The portability was absolutely amazing. You could program an application from the ground up on Windows and move the *binary* to HP-UX and it would run, perfectly.

    I loved the language, too. Because of the extensive class library, you could code major functionality in a method of, say, ten lines of source (often less).

    As our project matured, we were forced by upper/middle mgmt to develop in c++ on HP-UX. It was a pain until the company licensed a toolset called tool++.h, which was in a way very funny - what it did was provide a Smalltalk-style class library to our UNIX c++. We were able to do useful things, again! But, still, we always wished we were still doing it in Smalltalk.

  49. OK, I'm lazy by selectspec · · Score: 2

    Alright, I admitt I should probably spend a few hours pouring over python literature, but hey, that's what /. is for, right?

    So, my understanding is that Python is probably more useful for projects that involve lots of glue code (COM talking to CORBA talking to Java, etc). I also seem to get the impression that Python doesn't suffer from the "too chaotic for big project" problem that Perl has.

    So help me out here. I'm writing a huge, scalable middle-tier in Java using servlets and JDBC. Why should I bother with Python?

    Pros Cons etc. Whats the story here people?

    --

    Someone you trust is one of us.

    1. Re:OK, I'm lazy by mikeee · · Score: 1

      Maybe not; you're in Java's sweet spot.

      However, IMO, Java is starting to suffer from Ada syndrome; starting from a clean design, marketing and/or design by committee is causing it to add every damn possible feature in the world, causing a mess. Python, however, remains simple.

  50. Re:Why hasn't Python taken off? by ovapositor · · Score: 1

    That sounds like a VERY interesting project. I'm sure that you could find a home for it at sourceforge.

  51. Why hasn't Python taken off? by Speare · · Score: 5

    I heard about Python several years ago, from a guy who was at Xerox PARC at the time. Yet today, the Python movement doesn't seem to be much farther along.

    Java's lost some oomph in the marketing steamroller but gained some badly needed credibility with servlets.

    Perl has gone from an obscure report munger to a community powerhouse. You want a feature? Perl has it.

    Python's been ported to just about everything including PalmOS, but the shared source code I've found has been extremely limited or arcane. Yes, there are modules out there, but nothing like CPAN or gamelan or even MFC/C++ codeguru.

    From the little I've investigated of Python, at three different occasions, it's clean, fast, easy to embed, easy to extend, easy to code for. Some people balk at the indentation style but that took me 30 seconds to get over. Some people balk at the shell interpreter aspect, but that felt like a prolog or lisp pmachine interface to me.

    I'm not flaming, just wondering, what has Python been doing with itself, to have grabbed so little attention in the world stage?

    --
    [ .sig file not found ]
    1. Re:Why hasn't Python taken off? by Amokscience · · Score: 1

      Python is great for embedding a scripting control language into complex compiled (C/C++) systems. It's found it's way into many graphics rendering packages and it's used at ILM extensively. I meet people all the time that love Python. I meet more that love Perl and never bother to look at Python. I think Perl just has mindshare and people don't bother to look around.

      --
      Fsck cluebie moderators. I'll say what I want, offtopic or not. And fsck having to qualify every bloody statement just
    2. Re:Why hasn't Python taken off? by captaineo · · Score: 3
      The fact is, when you see python, there is'nt "one magic application" that suddenly jumps out as "the perfect thing" to use python for. I think that's because sucn an application does not exist

      I would say Zope (and persistent object databases in general) might be Python's "killer app." I've been doing a bit of work on a similar database system, and certain aspects of Python make it very well suited for this kind of stuff... e.g. a very clean object model, override-able __getattr__() and __setattr()__ methods, consistent reference semantics throughout, etc. Python is the perfect toolbox for building persistent and distributed OO systems.

      About the only extra things I've been wishing for are optional static type-checking and C-like syntax (I like my curly braces, so shoot me =). Static type-checking is really necessary because I'm finding that I make just as many type errors in Python as memory management errors in C =).

      Dan

    3. Re:Why hasn't Python taken off? by 4of12 · · Score: 2

      I think Python will take off eventually, based on my first hand experience.

      The simple syntax and powerful features of this scripting language make it an excellent choice as a first language. Last summer I got my 11 year old nephew playing with some simple programming concepts using Python.

      The generality and power of the language made it my first choice a year ago when I had to come up with a "mortgage recalculator" to figure out what payments would pay off the balance for certain interest rates in various time frames. Years ago I would have done that in C, Fortran, or HP-25.

      I'd love to use this language as the high level wrapper for some projects at work, but we're heavily into C++ frameworks and I don't feel up to the level where I could SWIG my way into Python.

      At any rate, I think Perl has the advantage of being first and an initially better regex capability. In that way, some of the thunder for scripting language audience share for Python was lost to Perl. This may be a reason that Tcl hasn't really caught on too much, either.

      In scientific circles. that handle numerical data for simulations and visualization more than text, you'll find a lot more fans of Python. The growth limiter there has been that any algorithm requiring extreme efficiency taxes a scripting language, forcing one into a multi-language environment, such as Python on top and C down below. Fortunately, with all the modules for Numerical Python, etc. becoming available this bottleneck is becoming less of an impediment and I think you'll start to see increasing usage.

      --
      "Provided by the management for your protection."
    4. Re:Why hasn't Python taken off? by teg · · Score: 3

      It's used for more and more projects in Red Hat Linux - it's used in the installer (since RHL 6.1), it's used in up2date, it's used in our new batch of configuration tools. If there needs to be a GUI, glade and python are there from the start.

    5. Re:Why hasn't Python taken off? by marnanel · · Score: 1
      We know what perl is good at, everything. [...] What _is_ python good at? Maybe it just hasn't found its niche?

      Good, sounds like there's a nice well-defined niche for Perl, then :)

      P.S. Perl's master plan (or what passes for one) is to take over the world like English did. Er, *as* English did...

      Larry Wall, 199705201832.LAA28393@wall.org


      my plan
      --
      GROGGS: alive and well and living in
    6. Re:Why hasn't Python taken off? by Tom7 · · Score: 1
      I consider python as lying somewhere in between scripting languages and compiled languages. ... To me, it's a lot closer to Java than Python.

      Python is closer to Java than it is to Python? ;)

    7. Re:Why hasn't Python taken off? by kreyg · · Score: 2

      I've used Python a bit to write scripts for Blender. Maybe I've been programming in C for too long, and maybe because Blender's editor sucks and deals with tabs differently than my external editor, but any language that is whitespace delimited just drives me insane. I could tolerate it for the purpose of elegance except for one thing:

      Tabs and spaces are treated differently!

      This means that I can write code that looks right, but the parser chokes on it. If I edit some else's code and they use spaces but I use tabs, everything gets screwed up. This, to me, defeats the entire purpose - "enforced readabiliy" far too easily easily gets transformed into "obfuscated syntax errors".

      This is the same reason makefiles make my head hurt. To me, it's a glaring user interface / usability problem, in an otherwise very cool language.

      --
      sig fault
    8. Re:Why hasn't Python taken off? by koolB · · Score: 1

      Perl is the crack of all programming I have ever done, from UNIX/C to MFC C++ and now Java. Python is STILL an advanced PHP to me, not quite thd fix I need with Perl. I love skipping a whole new language since one (Perl) does it all...and is more advanced. No one has come close to CPAN (yet).

      --
      --- Every day I am forced to add another to the list of people who can kiss my ass...
    9. Re:Why hasn't Python taken off? by sumengen · · Score: 1

      If egroups.com implementation has taken 180,000 lines of python; then they are doing something wrong (Or they are writing too many comments).

    10. Re:Why hasn't Python taken off? by iomud · · Score: 3

      We know what perl is good at, everything. We know what PHP is good at the WWW. What _is_ python good at? Maybe it just hasn't found it's niche? I don't mean to sound like I'm undermining the power of python I am sure it's very capable but where does it excel? What job makes python the right tool?

    11. Re:Why hasn't Python taken off? by paulcocker · · Score: 1

      remember, english ain't the most spoken language in the world, just the most spoken language in america

    12. Re:Why hasn't Python taken off? by number+one+duck · · Score: 2

      The indentation style is one of my favorite features. Its almost impossible for me to working code that isn't readable at the very least.

      Of course, enforced readability might very well be what is holding the language back. :)

    13. Re:Why hasn't Python taken off? by flippety_gibbet · · Score: 2

      I think as well as comparing the modules 'out there' one shouldn't forget the modules that python comes with. There are more than you could shake a very big stick at including XML, smtp, telnetlib, threading to name but a few. Together with other 'almost standard stuff ' such as Mark Hammonds win32 and asy interfaces to tk/wxWindows it makes a very attractive package. I hope it continues to snowball.

      --
      <-- You are here.
  52. Re:My Guess by beme · · Score: 2

    I'm no expert, but I'm not sure you can say absolutely that there are more appropriate languages than Python when it comes to doing oo work. Bruce Eckel is probably an expert though. Here's an interview:
    http://www.technetcast.com/tnc_stream.html?strea m_ id=466

    -beme

    --

    -beme
    1971
  53. Yes, this is a very nice book. by lsommerer · · Score: 1

    It [Python Essential Reference] makes no attempt to teach you how to program --so don't buy it if you are new to programming AND to Python. But ifyou've used several languages and want to do a project in Python it is quite useful.

    It is the only Python book I own, and the few times it has not had the information I need (mostly specifics about modules) I've been able to find what I need in the online documentation.

  54. Well, while we're evangelizing... ;) by Tom7 · · Score: 1

    How can I resist? For a redesign of lisp that is actually better, see Standard ML at:

    http://cm.bell-labs.com/cm/cs/what/smlnj/sml.htm l

    Also for a more hacker-oriented flavor, try O'Caml at:

    http://caml.inria.fr/

    Haskell (haskell.org) is also worth checking out, too.

    1. Re:Well, while we're evangelizing... ;) by Tom7 · · Score: 1

      I think I met you on IRC before. Is it still true that you haven't written any big programs in SML or Caml?

      I know you're unwilling to budge on this, but:

      There are advantages of code which can interpret itself, but the same functionality is easily achieved through the use of ML datatypes. Caml now even has a pre-processor which lets you invent your own syntax and do traversals if you really need it.

      Static typing is awesome for large program development. Your programs are faster, and you catch bugs earlier (no more run-time type errors!). When you need "dynamic" typing (and one seldom does), datatypes or caml's Variant types make it so, so easy. Pattern matching makes it easier to write than lisp code, too (though bigloo has made some headway here..)

      No other language I've seen has a module system which can compare to SML's. Polymorphism and functors are an amazing combination. The fact the language comes with a formal definition is also pretty keen.

      As for being expressive, isn't it impossible to represent a real, honest-to-goodness integer in lisp? (because it is always tagged for dynamic dispatch?)

      You should take 15-312!

    2. Re:Well, while we're evangelizing... ;) by Tom7 · · Score: 1


      By "function polymorphism" you mean overloading? You can use variant tags in ocaml to do the same thing, which is just what happens in lisp (except you can use pattern matching. =))

      Pattern matching is better than just conditionals. First of all, they can be compiled into jump tables for better efficiency. Second, you can nest them, which has the advantage of nicer-looking code (I guess this is subjective). Less subjectively, the translations of some patterns require duplicating code: the lisp version would have many copies of the same code which would need to be maintained in parallel.

      Lisp does not have static type-checking, at least not in the sense of SML or O'caml. It just doesn't!

      You really really should try out some more languages (in depth). Lisp is good, and indeed they are all turing-equivalent, but we have come a long way! You may thank yourself...

    3. Re:Well, while we're evangelizing... ;) by mrdlinux · · Score: 1

      I wouldn't mention SML ;) OCaML is much better. But neither of them is as expressive as LISP, sorry. The OCaML optimizing compiler kicks ass, but the language itself is not as expressive as Lisp is. The sacrifices were mostly made in the interest of speed. Plus, OCaML attempts to expand it's expressiveness through extra syntax, which is a fundamentally flawed method. Read the introduction to R5RS for a good reason why.

      And BTW, I'm at CMU too ;)

      --
      Those who do not know the past are doomed to reimplement it, poorly.
    4. Re:Well, while we're evangelizing... ;) by mrdlinux · · Score: 1

      Last time I was writing programs in OCaML, my computer hardware crashed and was out of commission for several weeks. I've been too busy in the time interval to do any more, unfortunately.
      According to a good friend, OCaML does not have function polymorphism (such as 'defmethod' in Lisp) but it can be achieved through various hacks.
      If you really want to write your own syntaxes nothing compares to the Lisp macro facility, (my friend wants to be able to infixify functions in OCaML, like in SML, but I think that's just a waste of time ;)
      All good Lisp compilers can infer types at compile-time, just like the OCaML compiler, and you can even specify static types and alter the amount of optimizing a compiler will do. Not only can you specify static types, but you can specify ranges as well! For example: (the (integer 0 100) x) specifies that x must be an integer from 0 to 100.
      Pattern matching is an interesting feature, but its not that hard to write a condition to check for a cons and then do something. Recursive types are also interesting, I need to experiment more with those.

      --
      Those who do not know the past are doomed to reimplement it, poorly.
    5. Re:Well, while we're evangelizing... ;) by oodl · · Score: 1

      For a redesign of Lisp that is actually better (at least for the unwashed masses), see... Dylan. Dylan is object-oriented from the ground up, has infix syntax, has hygenic macros, has a flexible module system, and has a native code compiler...

  55. Re:Why is code readability such a big deal? by Tom7 · · Score: 1

    I agree. I think this was a minor design error that they are always on the defensive about, since people always seem to point that one out. =)

    cc-mode for emacs does an awesome job of auto-indenting. Just go C-c C-q and the whole function is beautiful. Whee!

  56. Re:My Guess by Tom7 · · Score: 1

    I guess I was trying to say that for scripting tasks, you probably don't need the "object-oriented" methodology. For programs that do, well, there are more appropriate languages.

    Yes, I have tried Python. =) As I say, it is nice, but that's not what seems to count for (many) hacker types!

  57. My Guess by Tom7 · · Score: 4

    I think people prefer perl because, given all its intricacies and built-in features, programming in perl is fun. It's an adventure.

    Programming in python might produce better code, but it is enjoyable to write? Most write-only code (ie, scripting tasks) are tedious if you write them the "nice" way. Hackers find (perverse, perhaps) joy in writing these clever minimalist perl scripts that rely on its various uncivilized features.

    When it comes to writing big code, though, writing in any scripting language is problematic for a number of reasons. (Not the least of which are performance, lack of modularity features, and difficulty in producint "stand-alone" apps.) So even if Python may be a nicer language in almost every respect (and who's to say if it is?), that doesn't mean anything, because scripts were meant to be dirty.

    In other words, when it comes to scripting languages for use by hackers: terse, tricky, stateful, but "powerful" languages win.

    1. Re:My Guess by bockman · · Score: 2
      Programming in python might produce better code, but it is enjoyable to write?

      Yes. You can have all the fun you want (and more). Like many Very High Level Languages, Python frees you from most of the housekeeping a programmer has to do with C, C++ and even Java.
      Tanks to its coerent semanthics and clean syntax, you wont have to squeeze your brain trying to remember obscure rules (or checking brackets)).

      Did you ever give-up adding feature X to your program, because it would take too long? Just think : how much of this 'too long' was housekeeping? With python, you might find that you have the time ...

      --
      Ciao

      ----

      FB

    2. Re:My Guess by ultrabot · · Score: 1
      I think people prefer perl because, given all its intricacies and built-in features, programming in perl is fun. It's an adventure.

      Have you tried Python? I'm a sucker for the fun-factor in programming languages, and Pythons straight, clean syntax and straightforward implementation of object-oriented ideas (totally dynamic binding is a bliss for Quick-and-Dirty stuff) makes it every bit as fun as perl. Python "just feels right", while Perl is "everything for everyone" .

      Ever tried doing object oriented development in Perl? Used lots of references (Python uses references all the time), typeglobs? Fun? Well, perhaps it's fun but some people don't have time to learn all that stuff just to learn the kludges of one programming language.

      Obviously, perl rocks for awk/sed style stuff.

      --
      Save your wrists today - switch to Dvorak
    3. Re:My Guess by Ben+Wolfson · · Score: 1

      So even if Python may be a nicer language in almost every respect (and who's to say if it is?), that doesn't mean anything, because scripts were meant to be dirty.

      Look at this script and tell me if it's written nicely (and yes, it does actually work)

    4. Re:My Guess by hobuddy · · Score: 2
      lack of modularity features

      Apparently you haven't used Python, or even read the docs; modularity is one of its strongest features.

      Programming in python might produce better code, but it is enjoyable to write? Most write-only code (ie, scripting tasks) are tedious if you write them the "nice" way.

      First of all, I use the interactive Python console to accomplish simple scripting tasks, which is a breeze. I spend so little time accomplishing my goal that I can move on to something I really enjoy in short order, such as a more challenging program.

      If the task is slightly more complex, I figure out the basics on the console and then write the complete program in a module (in Python, a module is just a file of code--a "script"). When I'm done with my simple scripting task, that module lies around waiting for me to need some slice of its functionality (a function, for instance) in the future. If I do, I just 'import' it and go to town.

      For more complex tasks I use OOP, which is pleasant in Python, though not as formal and featureful as in the likes of C++. For example, I've written a fairly involved network app that uses both multithreading and sockets extensively. OOP happens to match the way I think, so I consider solid support for it indispensable (before you suggest this, I was not "raised on OO" and therefore did not begin exploring the broad world of languages with a favorable bias toward it).

      As for power, Python has it aplenty. The language's philosophy, though, is that extra power should be added uniformly--through the modules and class mechanisms--rather than cluttering the core language with lots of bizarre constructs.

      Concurrent programs are a breeze with the threading, there's a parser module for manipulating Python parse trees, an shlex module for concocting simple lexers right off the bat, a Numeric module for maxtrix manipulation and other scientifically oriented numeric programming, various imaging/graphics modules for graphics programming. These are just a few of the modules that I actually use. All of this, and the core language remains the best compromise of simpilicity (Lisp) and comfort I've ever used.

      For most programming tasks (even complex ones), C++/Java-type languages aren't clearly superior. Bruce Eckels, author of _Thinking_in_C++_ and _Thinking_in_Java_ (thus clearly well acquainted with both), says "Python is my language of choice for virtually all my own programming projects".

      --
      Erlang.org: wow
  58. Re:Python in enterprise by bockman · · Score: 1
    What is the answer to VB in Unix platform. One of the linux gurus had a reply: Python + Tk. While this may be a little far fetched, this is definitely the best available alternative till another one comes by.

    There are now. This is my preferred (YMMV): glade+python(with gtk and libglade modules). Yo go like this:

    • build visually yor GUI with glade, a very nice tool for the job.
    • Instead of generationg code, which IMHO is rather messy, you use libglade to glob the GUI files and generate on-the-flight all the widgets you need writing only few lines of code for file ( it even does 'automatic' callback bindings, which is great).
    • You code the logic behind the GUI in python, using python-gtk to manipulate GUI widgets.
      • Clean and fast.

    --
    Ciao

    ----

    FB

  59. Re:needs a Perl Journal equivalent by StandardDeviant · · Score: 1

    No actually I didn't know that. Thanks for replying, I may have to look at python again. (I suspected the semicolon was redundant but after hacking in C long enough it's sort of an instinct ;-) ).
    --
    News for geeks in Austin: www.geekaustin.org

  60. needs a Perl Journal equivalent by StandardDeviant · · Score: 2

    Just my two cents, becuase I think that having a central print magazine coming out every month is a really strengthening thing for a "marginalized" community (e.g. what the linux journal did/does for the linux community). I say "marginalized" from the standpoint that python is a much smaller community than, say, java.

    My other four cents worth would be a) something besides whitespace for block indentation (by that I mean let me use {} if I want to, and I do, if for no other reason that when I'm 5 levels deep and want to write something like
    someProperlyAndDescriptivelyNamedVariable = somObjectWithAnotherLongAndDescriptiveName.aMethod WithSimilarlyLongAndDescriptiveName(someObviouslyN amedParameters,someOtherObject.someOtherMethod());
    it's running off the side of a normal xterm real quick) and b) constructing a CPAN equiv. (addressed by posts above, so thats minus two cents).


    --
    News for geeks in Austin: www.geekaustin.org
  61. He mentions pygame a couple times by shredwheat · · Score: 3

    Ok, pygame is my project which wraps SDL for use with python. The project reached version 1.0 about a month ago. Just recently I was able to release SolarWolf, which is a full featured action/arcade style game. (it's worth your time in gameplay too) :]

    This type of project goes a good way to show python is more than up to the task for quick paced arcade games. Currently pygame is adding support for the pyopengl modules, which is looking surprisingly good in terms of performance.

    Honestly, seeing my humble project listed in the "What do you think are the most exciting developments going on in Python right now?" answer has made for a sweet day!

  62. Re:Reason's Python has never caught on for me... by Xiathome · · Score: 1

    Perl is hard to spell too... Pearl? Perl?

  63. Python and Smalltalk by charvolant · · Score: 2
    The features listed as Good Things in Python: object-orientedness, consistency of approach, ease of development, dynamic typing and so on. They all exist in Smalltalk. Smalltalk has the advantage of considerably greater maturity in terms of virtual machines and development tools. Yet Python seems to be gaining popularity as Smalltalk wanes.

    This isn't a dig at Python; something good is something good, no matter where it turns up. But what is it about Python which makes it popular, while Smalltalk never seems to quite make it?

    • The first and most obvious thing is Smalltalk's apalling marketing decisions. Run-time licenses, expensive development licenses and costly support obviously went some way to raising the bar, although there are now good, free versions of Smalltalk available for non-commercial work.

      But ParcPlace not taking up Sun's offer to bundle VisualWorks with SunOS. Ow!

    • I don't know what Python's memory footprint is, but Smalltalk's can grow quite large. With Java, perl and Python around, resource hunger no longer seems to be a crippling issue, though.
    • An O'Reilly book obviously helps :-)

    There's got to be more to it than that, though.

  64. Re:what a load of nonsense by ideut · · Score: 1
    I think I can safely say I speak for the entire slashdot community when I say "Lutz seems to have lots of fingers in lots of open source pies" and "Guido van Rossum is extremely ugly" and "Python is a language for hermaphrodites" and several other things that I really enjoy saying.,

    --

    --

    --

  65. Why hasn't Ruby taken off? by kriemar · · Score: 2

    All my respects to Python, but I have to ask the same question about Ruby.

    As you say, it's clean, fast, easy to extend, easy to code for. And there's no whitespace issues to balk at, even for 30 seconds (although there are legitimate reasons to balk at whitespace issues for more than 30 seconds).

    I have used Perl almost extensively, and love it--Perl deserves all the use and attention it has--but when I think of something "cleaner" I'd like to use, my thoughts switch to Ruby, not Python.

    In Ruby's case, though, I can probably say its age is why it hasn't moved further yet (at least in the U.S.;the first Ruby conference is this year). Ruby's acceptance has moved rather quickly when you think about it.

    If you have been thinking about Python, and haven't taken a look at Ruby, *please* do. You'll probably like it. Ruby's too good to not at least check out.

    www.ruby-lang.org

  66. Pegasus Mail v4 and Python by Kraft · · Score: 2
    For all you diehard pegasus mail fans who can't wait for version 4 to come out in a month or so, here is a snippet from the features list on Pegasus mail v4 progress page:
    * Python scripting language. Pegasus Mail has a completely new object-oriented interface for use by extensions and plugins. We have taken advantage of this interface to provide a special plugin layer for the Python scripting language, a widely-used Open Source scripting engine. Using this, it will be possible to develop your own scripts to do just about anything, and integrate them into Pegasus Mail. And yes, we will be making sure that we don't fall into the same traps as Microsoft regarding problems with scripts executed by mail.
    Pmail is not open source, and only runs on windows, but it's free, always has been, and it's the oldest windows mail client in the world! I only know Perl, but being the pmail fan I am, I guess I'll have to look into Python soon :)

    -Kraft
    --

    -Kraft
    Live and let live
  67. Re:Jython#PerlC++XMLNET is the Future by benspionage · · Score: 1

    Let this be a lesson on how fatal software bugs can be and how even bad jokes can lead to tragic results:

    The wrong poverty attribute is set in the method solveWorldPoverty() - I mean how bloody obvious was that but still - the worldPoverty attribute is actually part of the super languagePlatform.., Java and not relevant here. I should have set the attribute noMorePoverty instead. (Note to self: you are an idiot!)

    See how such a small error can cause such a catastrophic problems on a world scale! My apologies go out to all the victims. I am truly sorry.

    Just imagine if I had used Office 2000 instead of Office 10 to cure cancer though ... *shiver*

  68. Jython#PerlC++XMLNET is the Future by benspionage · · Score: 4

    Hahahahahaha! Python, Perl, Java, .NET, hot mamas, pimp daddies, you belong to me.

    I own your buzzwords .... I own your languages ......

    Ladies and Gentleman I introduce the language, the platform, the enabler that will unite the world ..........

    Jython#PerlC++XMLNET

    I have a prototype and some examples shown below, in java, for you to realise the power and show that I am not talking out my arse:

    public languagePlatformEnablerAndAllRoundGoodGuy Jython#PerlC++XMLNET extends Java implements Python, Perl, C++, C, C#, .NET, XML
    {
    private boolean worldPeace = false;
    private boolean noMorePoverty = false;

    public void solveWorldPeace()
    {
    // World peace brother!
    worldPeace = true;
    }

    public void solveWorldPoverty()
    {
    // No more poverty man!
    worldPoverty = true;
    }

    public void cureCancer()
    {
    // With the powerful new feature of M$ Office 10 who needs cancer!
    new MSOffice10().setCancer(false);
    }
    }

  69. Re:Does Python suck less than Perl? by number+one+duck · · Score: 1

    I think so, but thats personal bias. I've taken the time to acclimate myself to the language, and use it fairly extensively for html generation.

    I'm considering cleaning up my scripts and releasing them in some sort of mishmash, just on the off chance that other people can make use of them..

  70. Most Important Change by javaaddikt · · Score: 1

    "But perhaps the most important change is Python's growth in popularity. "

    $Cha-Ching$!!!

  71. 'end' is even worse than the whitespace by Flying+Headless+Goku · · Score: 1

    Words should not be used as delimiters of any kind.
    --

    --
  72. But that's a relatively new feature. by Flying+Headless+Goku · · Score: 2

    The whole issue in question would never have come up had this been available in the days of "Programming Python [1st Edition]."

    Instead of showing one simple way of doing it, he showed many complex ways of doing it, justifying it on the grounds of performance, thus implying that it was necessary for acceptable performance. These are exactly the kind of trade-offs and effort that one goes to a scripting language to not bother with.

    Where Programming Perl tells you over and over again "do it however you like, it's okay to be ugly as long as it's useful, don't worry too much about performance unless it bites you," Programming Python emphasizes things like performance, at a time when Python was much slower than Perl (has this changed much?), and well-thought-out elegant, maintainable code, in a language that's supposed to replace my favorite hack-it-out-in-five-minutes kludge language. That's entirely aside from the poor organization and generally bad writing.
    --

    --
  73. I agree totally. by Flying+Headless+Goku · · Score: 3

    I've got that steaming pile of excrement right here, propping up my monitor to eye level. The major practical example? How to implement a stack.

    In Perl, you want a stack? Use push and pop on an array. Want a queue? A deque? A shelf or scroll? Use shift and unshift too. It's all done in C, and faster than anything you can write yourself in a scripting language, even though it's all random access, too. In Python, you write a class, making sure you provide all the methods you will want to use with it, and carefully considering the performance issues of various methods, because you're working around a tremendously slow interpreter to make a basic data structure that should be built into every scripting language.

    (incidentally, the multifunction list of Perl is probably my favorite feature, even over regexps and hashes; I use stacks and queues for everything, far more often than I use random-access arrays)

    That's the impression I got from this book anyway. I was very enthusiastic about Python before I read Programming Python. To this date I don't know whether Python really only looks good until you actually try to use it, or I just got that feeling of utter hopelessness from the book.
    --

    --
  74. python for morons? by thinkit · · Score: 1
    "Some of this movement's initial motivation came from Guido's CP4E project--Computer Programming for Everyone"

    hmm, i don't like that. the common moron shouldn't program. maybe that's why it has a rather demented pascal-like 'for' syntax.

    oh well, i'll try to keep up with both p's. they each got their good points.

    --
    --how long till the operators are jailed for anime-induced pedophelia and /. dies?
  75. Hold the press: wxPython by justrob · · Score: 1
    wxPython

    There is also Boa Constructor for wxPython, a Delphi-like IDE.

    Much nicer than Tk.

  76. Here's what Larry Wall thinks... by reposter · · Score: 3

    "Perl is worse than Python because people
    wanted it worse." - Larry Wall, 14 Oct 1998

  77. Python in enterprise by kuttan+kaplingat · · Score: 1

    Python has been a good language for mission critical applications where maintaining the code is quite important. In a quite massive and critical system like the Google search system, Python has been quite extensively used and the reasons are obvious. The system tends to grow at a very fast rate and to cope up with it, we need a script language that is simple to maintain as well as that gives us the possibility of fast performance using embedded C code. What is the answer to VB in Unix platform. One of the linux gurus had a reply: Python + Tk. While this may be a little far fetched, this is definitely the best available alternative till another one comes by. In a world of C ,Java and Perl fanatics, Python is the silent language creating a revolution.

  78. Re:The big Perl v Python debate by WildForestBear · · Score: 1
    What is pissing me off is people suggesting that Python is better for longer programs "because it's easier to maintain". What a pile of shit!
    Yes. I am agree. I like perl python for use strict. I hate python for dynamic dictionary. This remind me good old FoxBase and VisualBasic, when you need to execute all branches of you program to be sure that it works. Of course when you calculating numbers or processing the files all can be under control. But if you use it for GUI or XML processing - bugs are here.
  79. Python vs. Ruby anyone? by pH!L!PP · · Score: 1

    That's right, i just wanted to know if the effort to learn just another language would be worth it... has anyone tried Ruby, any experiences how it competes with Python? Thanks, Philipp

    1. Re:Python vs. Ruby anyone? by aodl · · Score: 1

      I've tried looking at Ruby. Sadly, the latest version doesn't compile easily on Mac OS X and I haven't taken the time to figure out why. But from my brief looks at the Programming Ruby book and at some of the minimal documentation availabe in English, these are my thoughts:

      Cons
      • Lack of English Documentation -- Ever since I got in to Python (Py 1.3), the tutorials and library/module references have been great. They're pretty well organized and I can usually find an answer to a question pretty quickly. With Ruby, I had a harder time navigating the web site and finding comprehensive up to date information in English. note: as I was writing this, I found some better documentation. but getting to it was still non-obvious, and much of it was still pretty "light" on fuller descriptions of some cool looking features like Singleton Classes
      • Some Python 'issues' are 10 times worse for Ruby -- Some of the issues raised in these thread - lack of CPAN, etc... - are even bigger for Ruby. I don't know how long Ruby's been around, but it feels like a much younger language. They claim, however, that it's bigger in Japan than Python is. The number of built in and available modules for Ruby is still substantially smaller than for Python.
      • Too perlish in some areas -- Where this may be a pro or con depends on where you stand on String literals. :) Ruby has a fair amount of string modifiers to affect quoting of strings and regular expressions. Python has some string modifiers (ie, "raw" strings like foo = r'\bbank\b'), but things like Regular Expressions are made as objects. As for functionality of Regexes - Python, Perl, and Ruby all offer basically the same features, but in Python you might have to be a bit more wordy (not in the regex itself, but how you use match results, do substitution, etc). Personally, I prefer Python's way because I work on large systems and frameworks. The Perl and Ruby way work nice for massive text processing/shell scripting, but I've had a hard time maintaining them. Another example of Ruby as a shell scripting language similar to Perl is the use of backticks to spawn a sub-process, or its own %x/STRING/ expression. (ie: currdate = `date`). While this is a powerful feature, I think it makes the language in general more awkward for building large systems. In Python, this sort of functionality is handled by modules like os, a generally platform agnostic module around native system calls (on Unix, this is usually the posix module).
      Pros

      Closer to OO Purity -- Ruby is really closer to Smalltalk than it is to Python, without the stranger Smalltalk syntax and VM needs. Ruby's object system boasts the following features over Pythons:

      • No type/class dichotomy -- this will soon be done away with in the Python core, but currently there are still differences in Python between the object based Types (strings, lists, ints, etc.) and Classes. You still can't subclass from String in Python, for example. (However, in Python 2.0, Strings finally got their own methods). Python does put considerable effort into letting you write a class that smells like a string, list, dictionary, etc. Note: Zope has always used something call Extension Classes, allowing C based extension classes to be subclassable. This has allowed Zope to add some strong features to the object model at a core level, like Persistence and Acquisition. So Ruby, like Smalltalk and (most of) Java, has a unified object tree. Python doesn't (presently).
      • Better encapsulation/access control -- Python doesn't do strong enforcement of private class members, although Python 1.4 came out with decent a pretty decent solution to let you make pseudo-private class members.
      • super! -- As I said above, I work with large systems and frameworks in Python. In the current generation of the system, use of multiple inheritance has gone unchecked and ultimately has run wild. This makes doing things like letting your object handle an event tricky, because you should only really be handling what your subclass is responsible for, and then passing the buck along. In Python, this is usually done by calling a method on a parent class directly and passing self in as the argument. Well, this is all well and good if you know what class to call. Sometimes in large frameworks where mixing in using multiple inheritance has run wild, you don't know which class really does the behavior you need to do. Ruby gives you super. Python doesn't.
      • And speaking of mix-ins... -- I gleam that Ruby is a single inheritance language. Now, normally I love multiple inheritance but lately it's been really biting me in the ass. Usually, one wants to really subclass from one major object, and then mix in functionality. It looks like Ruby allows this by somehow mixing in module level functionality into a Class or instance.
      • Accessors -- This may fall into a syntatic sugar territory... But maybe not. In Python, writing an accessor means writing a method like setAge(age) and age() for a class, and then using them accordingly like bob.setAge(25) and bob.age(). But in Ruby, you can define a method like age=(a), and another one called simple age (done via a def age statement that returns the instance variable age). This doesn't look like anything fancy. In Python (and I assume Ruby), it's just as easy to arbitrarily set attributes on an object and read them back without accessors. BUT!, in larger systems/frameworks where things like persistent modules may change, or rules are associated with getting/setting an attribute (ie, you might want to raise an exception if someone tries to set age greater than 150), you have to use methods to get/set values. This is no big deal in Python, but I like how Ruby makes it look more natural. (In Python, I could have also overridden __getattr__() and __setattr__() to provide similar behavior - the freedom exists in Python to do what I want here, but it's not the default)
      • Yield, Retry, and Blocks -- There are non standard versions of Python (ie, stackless) that have some of these features. But Python doesn't have blocks. Blocks are cool, and a very powerful feature in Smalltalk. They're basically anonymous functions. Python has lambda:, but it's limited to being what can be held in a Python expression - you can't use full statements. Python 2.1, however, makes some nice inroads on this bullet point with it's new scoping rules (finally!) and List comprehensions.

      So, ultimately, my take on Ruby is that I really like it's object model. Basically, everything that it borrows from Smalltalk has been done cleanly and elegantly in a syntax that's less foreign that Smalltalks. On the other hand, it's also really trying to be a bizzarre marraige of Perl and Smalltalk. And I don't know how well that works with large systems, or for embedding - there's too many shell-scripting level games. I think Python does the right thing by giving access to shell-scripting level features through modules, allowing an embedded Python to more selectively enable and disable features by choosing which modules to expose. If you think of the term "scripting language" to mean something like shell scripts or awk/perl, Ruby is a very nice language with a lot of so called "elegant" features built in. At the core, it's a very simple language. But if you think of Scripting Language to mean "glue language", I think Python is way ahead here. While Python is definitely usable for shell scripting, it made the right choice in making that functionality available in modules instead of being a core language feature. As a result, Python's being embedded in UML Tools (Object Domain), 3D animation environments (Caligari Truespace. Python's also used heavily in many 3D/effects labs like Lucasarts, and whomever did the effects for Alien Resurrection), Flight Simulators (Fly! II uses Python to script "scenarios", allowing people to write their own custom ones), Image processing (used as a replacement for more cryptic command language used to process astronomy pictures), etc... I don't know how easy it would be to allow Ruby to fit in many of those environments. Python has also proven itself many times as a valuable rapid development language - the main features of Google were explored first in Python before being migrated to C for speed. I imagine Ruby could offer similar benefits here though.

      For Small Things (ie, shell scripts), I think things are pretty balanced between the two languages. Ruby has a lot of features familier to Perl users in what can be done with Strings, shell calls, etc. Python on the other hand comes with a pretty large set of well documented modules and objects that can be used "out of the box".

      For medium sized programs, I think Python is the better language - you don't have to worry about encapsulation and other OO features that much as you move into using modules and classes, and you get something very usable very quickly. It's really easy to have a program start it's life out as a script in Python and move it up to a full package of modules and classes by applying some simple refactoring rules. In Ruby, I have a harder time seeing the lines of where to do this.

      For very large systems that can still be achieved in languages like this (you'd be surprised at the size of some of the private Python programs in use), Python starts to break down. A lot of this is due to lack of formalized interfaces and contracts (There's a PEP on this, and some of these features might show up in the next release of Python), the class/type dichotomy, and lack of enforcement on encapsulation. In some cases, it's really cool that by default you can stick any arbitrary attribute on an object in Python. But eventually, this catches up to you. Also, multiple inheritance trees that grow unchecked can be quite a pain to deal with. Ruby's object model looks like it would be a better fit here. But Python is improving in this area. Things like Unit tests (pyunit now ships with the Python Core), Interfaces (if that change proposal gets accepted and integrated), and hopefully some sort of extension class like behavior are all there now or are coming. And they should help with dealing with the integrity issues that can plague very large Python projects.