Slashdot Mirror


Python Moving into the Enterprise

Qa1 writes "Seems that Python is moving into the enterprise. At the recent PyCon it has become apparent that it's not just Google, GIS, Nokia or even Microsoft anymore. The article points out that Python is increasingly becoming a perfectly viable and even preferred choice for the enterprise. More and more companies are looking at Python as a good alternative to past favorites like Java. Will we finally be able to code for living in a language that's not painful? Exciting times!"

818 comments

  1. Which Enterpise by Anonymous Coward · · Score: 4, Funny

    TOS or TNG?

    1. Re:Which Enterpise by Anonymous Coward · · Score: 0

      There are in fact 7 enterprises.
      Enterprise NX-01, NCC 1701, 1701-A, 1701-B, 1701-C, 1701-D, 1701-E.

    2. Re:Which Enterpise by Anonymous Coward · · Score: 0

      just Enterprise NX-01... last season

    3. Re:Which Enterpise by Buzzard2501 · · Score: 1

      What type of geek am I... First thing I thought of was Monty Python and ST:Enterprise. Where do I hand in my card?

      --
      Real programmers don't comment their code. It was hard to write, it should be hard to understand.
    4. Re:Which Enterpise by Kierthos · · Score: 1

      You are a TV geek.

      Actually, I thought the same thing you did. I mean, after the abortion that was Enterprise, you couldn't go much worse then a comedic sci-fi show set in the Federation.

      "I wish to register a complaint. This tribble you sold me. It's stone dead."

      Kierthos

      --
      Mr. Hu is not a ninja.
    5. Re:Which Enterpise by jacksonj04 · · Score: 1

      Ditto... but I think that was down to /the/ Enterprise.

      --
      How many people can read hex if only you and dead people can read hex?
    6. Re:Which Enterpise by Ziviyr · · Score: 1

      If its TOS then an LCARS styled Python editor wouldn't make much sense.

      --

      Someone set us up the bomb, so shine we are!
    7. Re:Which Enterpise by roseblood · · Score: 1

      Just plain old ENTERPRISE.

      But, think of it... J. Franks, M. Sirits (Riker and Troi) plus a snake? This is the show with Tipol(sp?) and de-con jell?

      I think I'll tune in for that episode!

      --
      There are lies, damned lies, and statistics.
    8. Re:Which Enterpise by OmgTEHMATRICKS · · Score: 0

      God, I know just how you feel. I thought that too. "What? Monty Python in a new Star Trek series? This is going to the best decision since.. decisions were first made!"

  2. Jython? by Crono · · Score: 4, Interesting

    Aren't some of them using Jython, which is really just Python on top of Java anyway.

    1. Re:Jython? by Anonymous Coward · · Score: 0

      I don't know about that, but I would have thought Perl was a better fit for the enterprise, due to Python's lack of 'hash references', and the paucity of modules Python has compared to perl.
      Various resource on the Internet seem to agree with me.

    2. Re:Jython? by pogofish · · Score: 5, Insightful

      The Jython language is still (essentially) an older version of Python. Just because it runs in a Java VM and can integrate with Java classes doesn't moot the point about doing enterprise work by "coding in a language that isn't painful."

      --

      A man without a God is like a fish without a bicycle.
    3. Re:Jython? by hey! · · Score: 4, Informative

      I don't find Java as a language painful.

      It's the output of Java programmers that turns my stomach.

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    4. Re:Jython? by Anonymous Coward · · Score: 0

      How the fuck is this interesting and insightful? I could say about the so called "native" implementation of Python is just on top of a von Neumann machine anyway. Whoever modded up the parent should really be ashamed of themselves.

    5. Re:Jython? by Anonymous Coward · · Score: 0

      I have to agree with you about Java programmers. While I know C better than Java, when asked I rate myself a 9/10 Java programmer and only a 8/10 C programmer. Why? Even though I am better at C, the pool of Java talent is so bad that it does not feel right to say that I am not a Java expert. I mean, I know a lot of self-proclaimed Java experts and yet I know so much more Java than them.

      With all that said, writing Java code is very painful after writing Common Lisp code for awhile.

    6. Re:Jython? by Taladar · · Score: 0, Flamebait

      Since the Java Standard Library is output of Java programmers programming Java IS painful.

    7. Re:Jython? by Anonymous Coward · · Score: 0
      doesn't moot the point
      Just like you don't idiom the English language, fucktard.
    8. Re:Jython? by Anonymous Coward · · Score: 0

      You, Sir, are one conceited cunt.

    9. Re:Jython? by Anonymous Coward · · Score: 0

      Care to explain why you think that? Because I don't think I am and would like to avoid confusing people in the future.

    10. Re:Jython? by afd8856 · · Score: 1

      From the article you quote (which is from 2002, btw):

      """Unlike mainstream languages like Java and Visual Basic, both Pearl and Python are only available for Unix operating systems. Although I am fully able to install and use Visual Basic on my Microsoft Intel Personal Computer, I was forced to draw my experience with Pearl and Python entirely from IRC and Usenet postings. Whilst it is possible to get a support contract for most languages, try it with Python and Pearl, and you will soon find yourself in "debate" with a 14-year old basement-dwelling hacker, who will first ridicule you, and then tell you to fix your problems yourself, since "you have access to the source code"."""

      First, I'm sure there was a python version back then in 2002, and second, if python or perl aren't languages capable of being used in enterprise, why are they used by some of the biggest in internet business, aka google and amazon?

      --
      I'll do the stupid thing first and then you shy people follow...
    11. Re:Jython? by hey! · · Score: 4, Insightful

      Well, my point is that more knowledge isn't necessarily a good thing, if it isn't coupled with judgment -- wisdom if you will.

      I think the level of knowledge among Java programmers is impressive, but by in large I've found they aren't necessarily better programmers because of it. I've learned this the hard way, by hiring people with incredibly impressive knowledge of Java APIs, and then watching them struggle with overengineered designs that attempt to drag as much of that knowledge in as they can manage. I'm not going to make sweeping generalizations here, only to state that I've had bad experiences Java guys who prefer to wander lost in the wonderfully rich world of Java APIs and frameworks than focusing on a customer's problem.

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    12. Re:Jython? by Anonymous Coward · · Score: 0

      And GNU+Linux running on an Apple machine is just OS X.

    13. Re:Jython? by Anonymous Coward · · Score: 0

      YHBT YHF HAND

    14. Re:Jython? by aardvarkjoe · · Score: 1

      I find it amazing that, even three years after its death, Adequacy still manages to get people to bite. That site was brilliant.

      --

      How can we continue to believe in a just universe and freedom to eat crackers if we have no ale?
    15. Re:Jython? by Anonymous Coward · · Score: 0

      Except that Jython has some pretty serious flaws... Try to convert 1.0 to an integer and it will blow up. And any floating point number over 10^10 will make it crash too. The worst thing is that Jython doesn't care about class ambiguity. You can import classes with the same name from two different packages, and Jython will happily use the first one it runs across without even complaining at all. Python is great. Jython is a piece of shit.

    16. Re:Jython? by Anonymous Coward · · Score: 0

      Well, have conversed with you previously I seriously question your judge of programmers. Sorry.

    17. Re:Jython? by tomsuchy · · Score: 1

      i was doing windows registry editing in perl in 1997, so i don't think the author of that adequacy article had all the facts. also, i figured out how to do this from modules nad information on the net, and didn't have to deal withy any 14-year old hackers.

      --
      this isn't a sig. i type this (including the two dashes), every time i post, just to make it look like a sig.
    18. Re:Jython? by Anonymous Coward · · Score: 0

      you are a piece of shit.

    19. Re:Jython? by Anonymous Coward · · Score: 0

      Maybe, but he's right. The number of crappy coders who think they are masters of Java spewed out by colleges every year is appalling. Many people hate Java merely because they've used programs written by people who have no idea what they are doing.

    20. Re:Jython? by Anonymous Coward · · Score: 0

      > I don't find Java as a language painful.

      Have you ever tried to make a list of integers?

    21. Re:Jython? by Ian+Bicking · · Score: 1

      BTW, there's been a lot of recent development on Jython in the past few months, and it should resolve a lot of its issues (it's been stuck on par with Python 2.1 for quite a while, while Python is now up to 2.4). The Python Software Foundation actually gave a grant to a developer to help resolve the issue.

    22. Re:Jython? by muizenkatten · · Score: 0

      Is it true? They said: "Python looks more and more like a "safe choice": It's taught in classrooms, budgeted and used in large organizations worldwide, and appears to attract successful enthusiasts. The time looks ripe for a language that has always emphasized its ability to "play nicely" with other technologies on a full range of platforms." http://programming.newsforge.com/article.pl?sid=05 /03/29/0747230/

    23. Re:Jython? by Magius_AR · · Score: 1
      I don't find Java as a language painful.

      It's the output of Java programmers that turns my stomach.

      Funny, I feel the same way about Perl.
    24. Re:Jython? by Jon+Erikson · · Score: 1

      Hehehe :)

      --

      Jon Erikson, IT guru

    25. Re:Jython? by Anonymous Coward · · Score: 0

      I agree. It's quite possible the #1 reason for language bias is that as the language gets simpler, so do the minds using it.

      Now, making a blanket statement saying that all C/C++ developers are development gods in comparison to a visual basic developer is obviously invalid. There are a substantial number of C/C++ developers that can manager to write code that compiles and runs, but is utter trash. Also there are Visual Basic developers that have a full understanding of programming theory that simply found a job paying well writing VB.

      The issue is resources. Companies often pay more for C/C++ developers since there are less of them and the software still needs to be written and maintained. After all, most commercial programs are still written in these languages. Companies looking for experienced C/C++ developers end up eventually with a better set of developers since a C/C++ developer needs to have a better understanding of how everything works and in a company like TrollTech (which I still visit regularly) the code is of excellent quality and documentation is amazing. Also projects with C/C++ developers are more likely to have a greater percentage of developers with masters degrees or better.

      In companies starting projects in a language like Python, the developers are more readily available since Python is a language most often used by self taugh developers. These can be people with an IT/IS education, but not necessarity a computer science education. Their skills start off by writing scripts in Python in order to accomplish a task. As time progresses, they learn more of the libraries and with practice have begun to maintain more complex scripts and even simple web applications. When all is said and done, they will later look for a job which pays more as a developer using their Python skills.

      This does not mean that there aren't higher educated Python developers out there, but the issue is that there are far more uneducated python developers out there. I know a few of them and I've even had to start shutting down my instant messengers during the day since I receive endless questions from them asking how to handle even trivial programming tasks. This is what drives the market value of a Python developer down.

      The author refers to making a living using python. The fact is simple. If you are a skilled/educated developer, the language used is of little relevance. I would imagine that 9 out of 10 developers that are in my company (about 150 of us in all) can write equally as well in Postscript as we can in C++ because theory is theory, even if we have to learn a new language for implementation, it's trivial.

      Of course to follow up with one last item, it should be mentioned that the language of preference often doesn't mean much, it's the libraries included with the language which often make people prefer one language over the other. It should be noted that C/C++ by themselves are decent languages, but quite shitty to develop with unless you have good libraries. Python on the other hand is a average language (in my opinion) but the library selection makes it quite useful.

  3. Advantages? by voss,+sometimes... · · Score: 4, Interesting

    Im not a coder my self, altough I hahe programmed in Java and in python, but I fail to see Python's advantages comparing to Java in an enterprise environment.

    Besides... wasn't Star Trek cancelled?

    1. Re:Advantages? by m50d · · Score: 2, Interesting

      http://netpub.cstudies.ubc.ca/oleary/images/python _java_comparison.gif may give you an idea. Quite simply it's easier to program in, and you're more productive using it.

      --
      I am trolling
    2. Re:Advantages? by Anonymous Coward · · Score: 1, Insightful

      Until you find out that you need to code most everything from scratch due to the lack of standardized libraries and frameworks, and you can throw the whole "productivity" argument out the window.

    3. Re:Advantages? by aldoman · · Score: 3, Insightful

      I agree -- Python is fantastic for quickly building small apps, or even much larger ones.

      The problem arises in Python's web programming support. The documentation is pretty much non-existent and you can soon get module-overload when you are importing more and more modules to do fairly simple stuff in web apps.

      Sometimes I just think while Python is most certainly a far better designed language, PHP/ASP.NET (C#) seems much more 'pratical', and it's definitely much easier to quickly build web apps in.

      Is there much effort to improve Python's web support? A manual with similar completion of php.net would help it go a lot lot further.

    4. Re:Advantages? by Anonymous Coward · · Score: 1

      You're aware that image is a joke, right?

    5. Re:Advantages? by khuber · · Score: 1
      If that isn't a stupid example, I don't know what is.

      The Java code is written so it looks verbose.

    6. Re:Advantages? by voss,+sometimes... · · Score: 2, Insightful

      Good point, but bad example.
      If you take out comments, which one is more easier to read?

      I have nothing personal against Python, actually I can say that I am a fan of python, but let's use a right tool for a right job.

    7. Re:Advantages? by Anonymous Coward · · Score: 0

      Unless these enterprises base their businesses on "Hello World", I don't see the relevance of that image.

    8. Re:Advantages? by Anonymous Coward · · Score: 1

      Please.. The java version is full of obvious and noninformative comments. A sane version of the java program would be more like:

      public class Hello{
      String myMame = "Duke";
      public void sayHello(){
      System.out.println("Hello " + myName);
      }
      }
      public class clientHello{
      public static void main(String[] args){
      Hello h = new Hello();
      h.sayHello();
      }
      }

      This version is 12 lines compared to 9 for python. Python has some things that you definately miss in java (lists spring to mind), but its not *that* much more verbose than python.

    9. Re:Advantages? by archeopterix · · Score: 4, Informative
      Until you find out that you need to code most everything from scratch due to the lack of standardized libraries and frameworks, and you can throw the whole "productivity" argument out the window.
      I'm curious about that, since my experience with Python is just the opposite - everything from http stack, unit testing framework to xml parsing is in the standard lib. Please name at least one area where Python standard library is lacking functionality.
    10. Re:Advantages? by Klivian · · Score: 1

      Yes there sometimes can be hard finding good libraries for Java and that can be a real problem. On the other hand are the availability of libraries for Python quite good and in addition it's rateher easy to make standard libraries made with c/c++ available to Python.

    11. Re:Advantages? by NeoBeans · · Score: 4, Insightful
      Amsing site, but... it didn't answer the original question. It just shows a comparison of two "Hello World" programs.

      The one thing that Java has going for it are "standard" APIs you can bank on. Is there a standard set of enterprise APIs for Python akin to J2EE?

      And all of this isn't to say that one can't leverage both technologies where appropriate, even in commercial products...

    12. Re:Advantages? by BasilBrush · · Score: 3, Informative

      If you haven't already, you want to get hold of a copy of
      Foundations of Python Network Programming.

      My only experience of web progamming in Python is the client end, for web-scraping scripts, and its great for that. The one problem I have is that once in every few hours urllib2 locks up whilst trying to get a page from a particular site.

    13. Re:Advantages? by CastrTroy · · Score: 1

      Looking at that picture turns me right off python. Just because you can do something in less code, doesn't mean it makes it a better language. Also, it's interesting that the Java example defined 2 classes, and then Python example only defined one. The Python example seemed to be doing the execution part outside of any class, in some non-object oriented fashion.

      It also appears that Python has no comments. There's no visible barrier such as } to say where the class or function ends, and the person doing the programming didn't really care to point out where it was, even though they did in Java, where it's obvious, because there is a }. I know in Python it's "obvious" because you can see where they stop indenting. But that's there in Java too, it's not forced, but any good programmer does that anyway, and most IDE's do it for you. This is where languages like Java really shine. By being object oriented from the ground up, and not just having OO as a new feature, like C++, VB.Net, PHP, and a few other ones out there.

      This usually leaves code in a mess somewhere between being object oriented and not being object oriented. This is not a place where you want your code to be.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    14. Re:Advantages? by m50d · · Score: 1

      In that example, about the same. Python has the advantage for being shorter, and "print" makes more sense immediately than System.out.println. Using new makes things a little clearer on the java side, but only a little. Declaring class members possibly makes it a bit more readable. But the python meaningful indentation makes things a lot clearer. The braces just get in the way, plus they mean it's possible to indent deceptively, by accident if nothing else.

      --
      I am trolling
    15. Re:Advantages? by TheoMurpse · · Score: 1

      I have programmed in both, and Python gets the job done so much faster that I want to crap my pants. Now that is REAL ultimate power. I love Python with all of my body (including my pee pee).

    16. Re:Advantages? by Anonymous Coward · · Score: 1, Funny

      so is the python code

    17. Re:Advantages? by rmccann · · Score: 2, Interesting

      A poor example. The java code is only longer because of all the braces. That example implies the only strength python has is lack of braces.

    18. Re:Advantages? by FidelCatsro · · Score: 1

      ofcourse i prefer ruby::
      ruby puts "hello world"
      or how about shell:: echo "hello world"
      Examples like this are not fair , however i do belive python is easier than java

      --
      The only things certain in war are Propaganda and Death. You can never be sure which is which though
    19. Re:Advantages? by Anonymous Coward · · Score: 0

      Why would the longer code be worse? Isn't the whole idea readability and maintenance? After all, the original cost of coding is only something like 20% of the TCO.

    20. Re:Advantages? by srid · · Score: 2, Informative

      The one thing that Java has going for it are "standard" APIs you can bank on. Is there a standard set of enterprise APIs for Python akin to J2EE?

      I am not trolling, but isn't the standard Java API painful to program with. Who wants to code 4-5 lines just for opening a file?

      In any case, there is PEAK for Python.

      --
      - srid
    21. Re:Advantages? by Anonymous Coward · · Score: 0

      in python you can just say

      print "hello world"

      and you have a 1 line valid python application.

      The example was comparing creation of an object with a constructor and a method.

    22. Re:Advantages? by platypus · · Score: 2, Interesting

      Really, try Zope.
      Yes, it's a little bit of a learning courve, but (and I did all of them for a living) it be beats Java/Tomcat/Struts and PHP hands down in productivity/maintainability once you get a grip on it.

    23. Re:Advantages? by vhogemann · · Score: 1

      Well, If you're using Jython to pave the road for a migration, you can use whatever you want from Java. Also, using Jython is a way to keep your codebase. I think that's the real advantage of python/jython, it's a nice "glue" language, that you can use to build applications based on whatever you already have.

      --
      ---- You know how some doctors have the Messiah complex - they need to save the world? You've got the "Rubik's" complex
    24. Re:Advantages? by afd8856 · · Score: 4, Informative

      Do yourself a favor and sacrifice 3 months of your life learning Zope & Plone. If you're into web development, it will pay off big at the end.

      It's like: why build your own search engine, security engine, your own membership system, html form engine, templating system, cache engine, skin system, content types & custom types, etc, when you can just use zope & plone and get a complete framework with open source products and addons on which thousands already develop at the highest profesional level?

      I admit that Plone and zope suffer from some documentation problem, but it's possible to overcome that. There are free books, available online (Zope book and The Definitive Guide to Plone) that can get you through. The documentation on Plone.org is getting very good. There are several code repositories (collective is one of them and some on zope.org) that have example products. Also, read the sources, they're not that hard to understand.

      And before any of you jump and shout Booo!! ZODB, let me remind you that you can use just as well a reqular sql server to store your content information.

      --
      I'll do the stupid thing first and then you shy people follow...
    25. Re:Advantages? by MemoryDragon · · Score: 1

      That easier to program is a myth which totally fails once programs become bigger. Besides that python does not bring anything really new to the table and is awkward in its handling of blocks. The only advantage python has is that every once in a while it is mentioned there are around 20 zealots which never did anything bigger than a few hello worlds start to scream how wonderful this language is. If you really need a good scripting language python does not really beat it, it is sort of an object pascal with a few safety nets removed and some bunch of lisp added (lambda functions). If you need a good scripting language go for Ruby, but neither of those I would use for a really big system.

    26. Re:Advantages? by thammoud · · Score: 1

      Too verbose for you?

      java.io.File myFile = new java.io.File("Some file Name");

    27. Re:Advantages? by Cyberax · · Score: 1

      Yes, and it's EASY to make a mess of tabs and spaces in Python. Aaaaaand now the best part: it won't work .

    28. Re:Advantages? by Anonymous Coward · · Score: 1, Interesting

      Exactly. I can literally rewrite the core of Zope in under three pages of APL. It's an extremely expressive and compact language. But don't ask me to maintain it.

      Hello world examples are contrived. In the enterprise, no-one gets paid to do hello world.

    29. Re:Advantages? by Anonymous Coward · · Score: 1, Interesting

      2D Drawing Libraries?

    30. Re:Advantages? by pivo · · Score: 1

      Why not the following, I don't see a second class in the python example:

      public class Hello{
      String myMame = "Duke";
      public void sayHello(){
      System.out.println("Hello " + myName);
      }
      public static void main(String[] args){
      Hello h = new Hello();
      h.sayHello();
      }
      }

    31. Re:Advantages? by neosake · · Score: 1

      How about

      public class Hello{
      String myMame = "Duke";
      public void sayHello(){
      System.out.println("Hello " + myName);
      }
      public static void main(String[] args){
      Hello h = new Hello();
      h.sayHello();
      }
      }

      For a grand total of 10 lines of Java against 9 for python (And really, should we be counting the closing curly braces?!).

      --
      "When a ball dreams, it dreams it's a frisbee"
    32. Re:Advantages? by Vengeance · · Score: 2, Insightful

      Yes, well, if your biggest problems with software development are an inability to deal with brackets or declare variables, you probably shouldn't be coding at all.

      What a silly picture.

      --
      It was a joke! When you give me that look it was a joke.
    33. Re:Advantages? by Anonymous Coward · · Score: 0

      I comment about Python having the "some bunch of lisp added," while true is misleading. Using the more Lisp-like features of Python are actually frowned upon and there is a bit of serious talk about removing them.

    34. Re:Advantages? by claes · · Score: 1

      Does Python have any equivalence of Java servlets? What support is there in the Python standard libraries for writing web applications?

    35. Re:Advantages? by Taladar · · Score: 1
      The Python example seemed to be doing the execution part outside of any class, in some non-object oriented fashion.
      If you think Java embedding the main program into a class is object oriented you should relearn what object oriented really means.
    36. Re:Advantages? by Anonymous Coward · · Score: 0

      built-in TK

      or if you want sdl/game type gfx:
      http://www.pygame.org

      also any of the many other gfx kits:
      py-gtk, wxPython, etc.

    37. Re:Advantages? by rakanishu · · Score: 1
      Does Python have any equivalence of Java servlets? What support is there in the Python standard libraries for writing web applications?
      http://snakelets.sourceforge.net/index.html Snakelets
    38. Re:Advantages? by BasilBrush · · Score: 0

      What won't work?

    39. Re:Advantages? by DrSkwid · · Score: 1

      Not in the standard lib but : Quixote is the one I use.

      --
      There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
    40. Re:Advantages? by jbolden · · Score: 1

      I'm a Perl guy myself but the main advantage of higher level languages is higher programmer productivity. The less the programmer needs to think about other than automating the task at hand the more productive he is (as zillions of studies show) assuming that simply automating the task at hand is the goal.

      In terms of standard APIs, they aren't as much of an issue with dynamic languages. You have libraries and you can easily move those libraries around include them with your apps. In general you aren't interfacing the system at a low enough level for this to be a problem. So as a result you often end up with code that is more cross platform.
      Take a simple example on a Unixy type environment (including NT) information is stored in a file as a linear stream of bits. On Mainframeish systems information is stored in an ISAM format (essentially a database table). So on Unixy system accessing the 6th column on 10327th line is difficult while on a mainframe its trivial. Conversely streaming the file to the screen is meaingless on a mainframe and meaingful on a Unixy system. How does the Java API handle this issue?

    41. Re:Advantages? by BasilBrush · · Score: 1

      Different programming languages have different pros and cons. It is of course perfectly possible to produce large systems using Python. Take a look at Zope for example. But I wouldn't want to do GUI apps using it. For what it's intended for - scripting, non-GUI apps and prototypes, it's the best I've come across. Compared with Ruby, it's about the same, it'd be a closely fought beuty contest between the two.

    42. Re:Advantages? by Anonymous Coward · · Score: 0

      Care to provide a character count (not counting whitespace)?

    43. Re:Advantages? by gclef · · Score: 1
      let me remind you that you can use just as well a reqular sql server to store your content information

      ...except for images, (external) documents (such as pdfs, .docs, etc), authentication information, authorization information...I could go on, but you get the idea.


      Don't get me wrong, I think zope/plone is very powerful, but one of my requirements when looking at zope was that it be able to use a database backend that we could hand to our DB group & have them manage...psycopgdb worked if we only wanted text & numbers (and were okay with re-building the access table if the zope box ever died)....when we tried to put jpg's and .doc's in there, it failed miserably.

    44. Re:Advantages? by hey! · · Score: 4, Informative

      Having used both, I'd say that Python is quite a bit terser than Java, which is very good in itself. Java is a bit pickier at compile time, which usually is a good thing.

      Probably the biggest difference is that there are no checked exceptions in Python. Java has both checked exception and non-checked ("runtime") exceptions, but the normal type of exception used in practice is checked. A checked exception is compulsory for the caller to handle or to pass up.

      In theory, a programmer using an API with checked exceptions has to consider all the things that could possibly go wrong. In reality, the idea you can catch every error before you get to testing is a pipe dream. You often don't know what you want to do with it until you have some empirical experience with your basic design. So you do one of two things -- either handle the exception in a half-assed but temporary manner (hoping you'll remember to come back and fix it later), or you pass the buck.

      Since the best of these two alternative practices (passing the buck upward) is the better, that means that it is a lot of work to get traction -- you can create a facade layer to orchestrate all kinds of low level stuff, but there is a tendency for that low level stuff to bleed through your facade. Modern Java practice (within the last couple of years) has rediscoverd the runtime exception -- which works exactly like the Python exception. Hibernate 3, for example, uses runtime exceptions. Personally, I'll rip bleeding strips off flesh of one of my guys who does something stupid with an exception -- because it's so easy to just wrap it in a runtime exception (we have a wrapper class for this) and rethrow it. Throwing an exception in a tester's face leads to quicker fault discovery than papering it over.

      I think the remaining difference between Python is that it's concept of collections are built-in, whereas the Java language only has generic objects and containers are built using this low level stuff. The resutl is that Python gets a big win when it comes to providing terse, convenient and easy to read syntax for processing all the elements in a collection. In programming terms, this task is about as common as dirt on a farm, and is a major win for Python.

      I think Groovy may be more the way to go for Java shops looking for a productivity boost. Python has its own set of gotchas. Which is not to say it isn't quite good, but I'm not a big fan of the idea of combining Java and Python.

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    45. Re:Advantages? by Anonymous Coward · · Score: 0

      that is so retarded. The main reason enterprises like Java is the culture of being verbose. Being verbose makes maintaining code easier. That plus the javadocs make java very attractive to enterprise projects. Anyone can write code in what ever language. the difference is how easy it is to maintain the code. being more verbose makes it easier. languages that are less verbose make it harder to maintain.

    46. Re:Advantages? by Bob9113 · · Score: 1
      http://netpub.cstudies.ubc.ca/oleary/images/python _java_comparison.gif may give you an idea. Quite simply it's easier to program in, and you're more productive using it.

      I write code professionally in both Java and Python, and I like them both. First, that comparison graphic was not meant to show two nearly identical programs; the Java version is significantly expanded. Following is a version more suited to direct comparison:
      1. public class Hello {
      2. public String myName = "Monty";
      3.
      4. public void printHello() {
      5. System.out.println( "Hello, " + myName );
      6. }
      7.
      8. public static void main( String[] args ) {
      9. Hello h = new Hello();
      10. h.printHello();
      11. }
      12.}
      So, extra lines for the curly braces, plus the instance parameter declaration, and Java allows the implicit constructor. Not much difference.

      But what of that declaration difference? Well, Java is strongly typed. Each class is fully defined before it is used. Python is more flexible.

      Which is better? It's like asking if a dump truck or a motorcycle is a better vehicle. Java is better if you want to make libraries that take longer to incorporate, but also make it harder to use them incorrectly. Python is better if you want to make flexible code that lends itself to poor maintainability. (and yes, I know you can write maintainable code in Python, it's just that Java does more to impose maintainability)

      Much like the Perl v. Java debates (I do Perl too): Are you writing a 25 line one-off? Use Perl. Are you writing a 250,000 line CRM system? Use Java. Are you writing a 25,000 line log analysis app which will have a very string intensive section? Tough call.

      In short, Python is more flexible, and therefore gives you more rope with which to hang yourself. Java is more strict, and so slows you down a bit to reduce your ability to write unsafe code. It's a toolbox. You put the tools in and you do the job.
    47. Re:Advantages? by TravisWatkins · · Score: 1

      Encryption is a big one, you need python-mcrypt for that.

      --

      "But I'm still right here, giving blood and keeping faith. And I'm still right here."
    48. Re:Advantages? by Anonymous Coward · · Score: 0

      Yes, a goofy contrived example of 'Hello World' is all the proof I need that Python is simpler than Java...

      Just because a language forsakes curly brackets for some spacing paradigm doesn't make it 'easier' or make you 'more productive'. It just means you have to type less. Personally, the bracketed version is easier to follow. I'll space how I prefer thank you.

    49. Re:Advantages? by Aeiri · · Score: 1

      Too verbose for you?
      java.io.File myFile = new java.io.File("Some file Name");


      Yes, actually. Why do you need to have "java" there? Yes, we know we are programming in Java!

      That's like this:
      myFile = python.open("Some file Name")

      Instead of (the real way to do it in Python) this:
      myFile = open("Some file Name")

    50. Re:Advantages? by Shazow · · Score: 1
      "It's like: why build your own search engine..."
      Heh yeah, I can see it now: Google on Zope & Plone. :-)

      If you ever want to create something "new" (whether it's the entire concept or just the approach), you more or less have to write it from scratch.

      I had a look at Plone, it looks like a nice CMS, very standard. The problem is, often what I want to create isn't standard.
    51. Re:Advantages? by Anonymous Coward · · Score: 0

      I think most people know that LOC is fairly meaningless. Non-whitespace characters is a lot more telling stat.

      You speak of Java being strongly typed, which is true, but you stop short of saying Python is in favor of saying it is more flexible. It seems have confused things. Python too is strongly typed. This flexibility of Python that you speak of is dynamic typing (Java is statically typed).

    52. Re:Advantages? by afd8856 · · Score: 1

      I wasn't talking about a search engine such as Google, but of a "site search engine". The nice thing about zope is that is very easy to create new content types that are searchable and you can even index word and pdf documents.

      About the standardness of Plone: if you're refering to the look, that is easy to modify, as the skin is very customizable from CSS. If you mean that you're building a different kind of CMS, I don't see why you can't benefit from the standard features and define your own custom workflows and content types with Plone.

      --
      I'll do the stupid thing first and then you shy people follow...
    53. Re:Advantages? by Anonymous Coward · · Score: 0

      How about encryption and security, SOAP, ORB, web services, directory services, messaging services? You know, all those things that distinguish large enterprise applications from normal business applications. The difference between Java and Python is similar to the difference between C# and Visual Basic. Now, you can soundly argue that most applications don't need these in the standard library, but if you do you are not making the argument that Python is good for large enterprise applications.

    54. Re:Advantages? by 0racle · · Score: 1

      SNMP. I also have to download and compile extra libraries for database access, but my biggest gripe, beyond the significant whitespace was no completed SNMP libraries.

      --
      "I use a Mac because I'm just better than you are."
    55. Re:Advantages? by Anonymous Coward · · Score: 1, Interesting

      That doesn't open a file; it creates an instance of a filename. You can't read from a File instance.

    56. Re:Advantages? by CrocketAndTubbs · · Score: 5, Insightful

      Its the package name for the class File. Similar to c++ namespaces. Its a CS thing dude.

      That said, the grandparent poster was a bit disingenous. The File class is roughly equivalent to the stat function/structure in C. You can't read the file without creating an inputstream/reader.

      So yes. You are correct. It is more verbose when doing simple operations. But I like to think that more complex operations fall together more easily.
      Many programmers like to whip something out now. A quick "one off". Instead, often, with a little more time and more ground work, they can make something that is reusable.

      In terms of the IO being verbose. Well its pretty flexible. 2 Interfaces (InputStream/OutputStream) are used for many different opertations. Read/write a file. Read/write to/from a socket. Read/write from a string or byte array. Read/write serialized object s to/from a file/socket/etc.... Its not just File IO. Its ALL IO. Long story short, that is why.

    57. Re:Advantages? by pivo · · Score: 1

      The File class is in the java.io package. Standard java packages start with java. or javax. You could do this instead:

      import java.io.File;

      File myFile = new File( "filename" );

      Very much like Python's packages.

    58. Re:Advantages? by jaydonnell · · Score: 1

      "every few hours urllib2 locks up whilst trying to get a page from a particular site."

      I use urllib2 very heavily and haven't had any problems with it. Then again I open a new thread for each use of urllib2 so maybe we're talking apples and oranges.

    59. Re:Advantages? by Usquebaugh · · Score: 1

      Hello SmallTalk, CLOS and Ruby

    60. Re:Advantages? by Anonymous Coward · · Score: 0

      But you DO realize that python is much more object oriented then Java will ever be?

    61. Re:Advantages? by Anonymous Coward · · Score: 0

      Python has all of that shit.

    62. Re:Advantages? by hunterx11 · · Score: 1

      Just, but pirates prefer Perl because of Parrot. Go shove a frisbee down your throat, freak.

      --
      English is easier said than done.
    63. Re:Advantages? by arevos · · Score: 3, Insightful

      How about encryption and security, SOAP, ORB, web services, directory services, messaging services? You know, all those things that distinguish large enterprise applications from normal business applications.

      I do suppose if your definition of a good enterprise language is one with all such libraries included, then Python isn't a very good enterprise language. Of course, one could argue that the benefits of Python outweigh the disadvantages at having to download extra packages to handle SOAP, ORB etc.

      The difference between Java and Python is similar to the difference between C# and Visual Basic.

      I'm a little confused. Are you saying that Python is inferior to Java because Java comes with library X included, whilst with Python library X has to be downloaded separately?

      Python is slower than Java and higher level than Java, but beyond that I can't say that there's too much separating Java and Python as languages. Personally, I find programming in Python more efficient, despite having more years experience with Java, but that may be just me.

    64. Re:Advantages? by Sunspire · · Score: 1

      I think the remaining difference between Python is that it's concept of collections are built-in, whereas the Java language only has generic objects and containers are built using this low level stuff. The resutl is that Python gets a big win when it comes to providing terse, convenient and easy to read syntax for processing all the elements in a collection. In programming terms, this task is about as common as dirt on a farm, and is a major win for Python.

      I have found that when you have collections as first class elements in a language like Python, it has rippling effects throughout your entire design. In another language, for example when duing GUI programming and you attach a signal callback you suddenly find yourself needing to pass multiple data to the callback. The callback format is predefined so you end up

      a) Changing what you're doing so you don't have to (the usual solution)
      b) Making a struct/class with your data pieces, which you end up using all over the place because it becomes too convenient
      c) Make one or the other piece global to your program or module

      With Python you don't think twice, you pack it as a tuple, and move on. The result is that's it just pure fun to program in Python. You're almost never running into the walls of the programming language or the APIs, the code also ends up better looking because you're not fighting the language, instead there's a very natural flow to it.

      Also the ability to drop out of the object oriented mindset when it just doesn't make sense should not be underestimated.

      --
      It's like deja vu all over again.
    65. Re:Advantages? by TheoMurpse · · Score: 1

      Well played, sir. At first I didn't recognize the reference, and I was shocked to think someone would lash out like that. But then it slowly dawned on me: "oooooohhhhhhhhhhhh".

    66. Re:Advantages? by yason · · Score: 1

      Probably the biggest difference is that there are no checked exceptions in Python. Java has both checked exception and non-checked ("runtime") exceptions, but the normal type of exception used in practice is checked. A checked exception is compulsory for the caller to handle or to pass up.
      ...
      I'll rip bleeding strips off flesh of one of my guys who does something stupid with an exception -- because it's so easy to just wrap it in a runtime exception (we have a wrapper class for this) and rethrow it. Throwing an exception in a tester's face leads to quicker fault discovery than papering it over.

      What's that difference between Python and Java in this regard if checked exceptions are generally considered a problem in Java and worked over to behave similarly to as in Python?

    67. Re:Advantages? by Anonymous Coward · · Score: 0
      okay, how about...
      RandomAccessFile file = new RandomAccessFile( "/some/path" );
      I'm not taking a stand for or against Python, but let's not be intellectually dishonest.

      And as a upside, I can't later do this:
      file = "This will not compile.";
    68. Re:Advantages? by sorlov · · Score: 1

      PSF has given a grant to implement SNMPv3 in 2005. So your wish will probably will soon be fulfilled.
      http://www.python.org/psf/grants/

    69. Re:Advantages? by BasilBrush · · Score: 1

      So maybe one of your threads gets blocked and you don't notice? But probably not. It's one particular site that I've noticed it on, and it only happens when I try am sending a lot of requests (though one after another) for a long time.

    70. Re:Advantages? by Anonymous Coward · · Score: 0

      What a shame, modded-down but so damn funny.

    71. Re:Advantages? by m50d · · Score: 1
      The Python example seemed to be doing the execution part outside of any class, in some non-object oriented fashion.

      Yes. And that's because in Python it is possible to do non-object oriented code, you have the choice and can use OO where it's needed, and not where it isn't.

      you can see where they stop indenting. But that's there in Java too, it's not forced, but any good programmer does that anyway, and most IDE's do it for you.

      It's possible to have deceptive indentation, or indent wrongly by accident. The IDE doesn't always get it right. And when you have the indentation you don't need the braces. It looks so much clearer without them.

      By being object oriented from the ground up, and not just having OO as a new feature, like C++, VB.Net, PHP, and a few other ones out there.

      Java is different, from C++ at any rate, because it forces you to go OO for everything. Which is not pleasant when you're trying to do something simple with it, or even quite complicated things where you've determined OO is not the best approach. Python's object system is the best I've ever used, because it works very well, but also doesn't get in the way when I don't want it to. The objects are there from the ground up - even the classes are proper objects - but if you don't need them, they stay out the way. Which is how it should be.

      --
      I am trolling
    72. Re:Advantages? by rsheridan6 · · Score: 1

      Actually, they're taking lambda out of python.

      --
      Don't drop the soap, Tommy!
    73. Re:Advantages? by m50d · · Score: 1

      Yes, but what's the use of the extra stuff? Python's shorter length actually makes it more readable. There's nothing irrelevant, but what there is is more than verbose enough. Having no braces is good, because the indentation is what the eye looks to. And having to add wrapper classes because someone thinks everything needs to be object oriented doesn't increase readability any, quite the opposite.

      --
      I am trolling
    74. Re:Advantages? by m50d · · Score: 1

      Yes there's nothing really new, but it's better done. Being new and revolutionary doesn't necessarily make a language more useful. The blocks work far better because indentation is what, visually, you look to when trying to understand the code, not the braces.

      --
      I am trolling
    75. Re:Advantages? by sketerpot · · Score: 1

      Any decent Python editor (including IDLE, which comes with Python) will just use a standard number of spaces and no tabs. I've never had tab/space problems with Python. How is it easy to mess up? Are people trying to edit Python code with Notepad or something?

    76. Re:Advantages? by m50d · · Score: 1

      If the Hello class is meant to be reuseable I don't think you can do that though. Which shows another important difference: in Java, you have to do classes for everything. Which I find to be a problem. Yes OO is good, but it's not necessary for everything.

      --
      I am trolling
    77. Re:Advantages? by m50d · · Score: 1

      No, but this example is, IME, representative of the two, and far shorter than anything else I could show you. Having to type less makes you more productive, plain and simple. And are you saying you follow a program control flow by its bracketing rather than indentation? Because if so I suspect you're very much in the minority.

      --
      I am trolling
    78. Re:Advantages? by m50d · · Score: 1

      But the increased verbosity of Java over Python is solely due to unnecessary junk, principally the braces, which only serve to confuse.

      --
      I am trolling
    79. Re:Advantages? by m50d · · Score: 1

      No, my biggest "problem", if such it is, is I don't like writing unnecessary code. I've got no problem writing the braces and declarations, but they just waste my time and mean I get less coding done.

      --
      I am trolling
    80. Re:Advantages? by Dan+Ost · · Score: 1

      In short, Python is more flexible, and therefore gives you more rope with which to hang yourself

      I respectfully disagree that Python's increased flexibility somehow makes it
      more dangerous to use than Java.

      I've used Python for several large projects and have never found a situation
      where Python got me in trouble that would have been easily avoided in some
      other language. In fact, whenever I finish a large Python project, I'm always
      amazed at how the natural way of doing things in Python helped me avoid problems
      that I would have had if I'd been using C/C++ or Java.

      As an aside, using Python has made me a better C/C++ programmer since it's
      made me more aware of the dangers and productivity sinks of C/C++.

      --

      *sigh* back to work...
    81. Re:Advantages? by Zenethian · · Score: 1

      PIL - Python Imaging Library

      http://www.pythonware.com/products/pil/

    82. Re:Advantages? by MemoryDragon · · Score: 1

      Thank god... I always hated lambda and saw this stuff as unneccesary... seems like a wise move to me

    83. Re:Advantages? by MemoryDragon · · Score: 1

      Is it really better done? The class library is very extensive, I give python credits here, java and especially smalltalk lead the way. Smalltalk and ruby have much better introspection, so does java although I admit the java introspection is complicated to use. The use of wildcards as block idents sounds like a good idea but failed way before python in the past (make) because you usually start to bang your head once tabs and spaces are mixed and you cannot see that. The integrated data structures are a nicey though and taken straight from lisp. (Smalltalk sort of has that too but in smalltalk you have only three core commands the rest ist the classlib anyway) The syntax remindes more very strongly on object pascal, which in my opinion is nice. The heads up the ass attitude towards optional declarative instance variables is plainly wrong. The python devs constantly say that you dont need that (perl has strict to my knowledge) and you should write unit tests instead. Everybody who had to deal with bigger systems know how stupid this attitude is because you often dont have time to write unit tests for every method you write and a separate check gives you a small extra safety net to catch typos. Dont get me wrong, Python is a nice language, but way to overestimated. I see it as a good rexx replacement as an easy to learn nice scripting language which is readable. But doing bitter systems with it, no way. There is a reason why Zope basically is pretty much the only big system ever done with it.

    84. Re:Advantages? by Anonymous Coward · · Score: 1, Interesting

      I call bullshit. I took 6 months for myself and my team to try to build a real application with Zope, with terrible results. It turns out that Zope uses all of the wonderful Python features such as monkey patching to achieve a situation where anyone coding a non-trivial application on Zope must read through most of Zope code to understand weird regressions and even to be able to write non-trivial features. The Zope Book covers only the most trivial of uses, completely unlike J2EE documentation and the interface Javadocs for any available Java libraries.

      To us, results are more important than the tools used to achieve them, and therefore investing 6 unproductive months into reading low-level Zope code instead of using them to develop our product was a tremendous waste.

      In the end, we were unable to deliver a working Zope system because the only Oracle and LDAP libraries for Python available in the whole wide universe leaked memory and had threading problems, and the ZODB system had extreme rollback regressions.

      We had to scratch the Python development and start again in Java, using Spring and Hibernate, and were able to deliver the product barely in time.

      If I was irrationally fond of Python and Zope over the alternatives which have been proven to work today, and are widely supported, I suppose I could ignore all these clear and severe problems with Python in enterprise space, but since I'm a rationalist, I cannot simply close my eyes from reality.

    85. Re:Advantages? by fyngyrz · · Score: 3, Interesting
      There's another advantage for me, not quite so obvious, that Python's indentation mechanism brings to the table.

      I program a lot. In the course of my job, I have to review a lot of other people's code. I have a particular bracing style I use; and sure enough, I've not only become accustomed to it but also "tuned" to it to the point where it becomes difficult to read someone else's code if (for instance) they use the "K&R" style:

      if (condition) {
      ....do_this_stuff();
      }

      Because at my company, code looks like this:

      if (condition)
      {
      ....do_this_stuff();
      }

      Those two styles lead to a considerable difference in code density, and so affect readability and my "tuned" response to what I see. And there are so many other C/Java coding styles re bracing and indentation, or lack thereof.

      In Python, there is one indentation style. Just one. Not bunches of them. So I get used to the way Python looks, the "tuning" goes into my backbrain or wherever the heck that stuff lives, and I can read anyone's code. This is a distinct benefit for me, and I suspect for others as well.

      I would have loved a C compiler that didn't use braces, but used indentation instead. Man, that would have been glorious. Sigh.

      --
      I've fallen off your lawn, and I can't get up.
    86. Re:Advantages? by Bob9113 · · Score: 1

      I've used Python for several large projects and have never found a situation where Python got me in trouble that would have been easily avoided in some other language.

      First, let me be clear, so there's no misunderstanding: I use both statically typed and dynamically typed languages both for work and for play. I like them both.

      Why would anyone use static typing?

      You may be smarter than the average bear, maybe compiler warnings are nothing but a nuisance to you. However, for many of us, they allow us to focus on the logic and let the machine catch conversion errors and invalid method calls. And even those of us who are above such things may write libraries that are used by other developers. Those other developers may be just starting in the language or problem space we are coding in, or may just be getting into professional computer science altogether. For those people, strictness is helpful. Knowing that you get a loss of precision when you call int = int + float is something some people don't automatically know.

      Heck, I've been doing this for a long time, and I still appreciate the warning when I'm hammering through a block of code and use the wrong type accidentally.

      Likewise, knowing at compile time that you can't invoke ".foo( Argle bargle )" on an object of type Baz saves you from having to find the error in runtime testing. When you've got a million lines of code to test (and are working with a team, not all of whom have rigorous unit testing habits), there are invariably blocks of code that don't get exercised until the product reaches the customer. Adding strict type checking saves some of those errors. Beyond that, a good set of interfaces with method calls that clearly state their purpose can even make it possible to implement extensions without having to RTFM.

      Is it necessary with all teams? No. Is the benefit always greater than the cost? Of course not. But there are situations in which it is beneficial. Saying that strict typing is never beneficial is silly. A lot of people who have a damned site more experience than you and I put together have chosen type safety for some languages, and they did so for good reasons.

    87. Re:Advantages? by Shazow · · Score: 1
      "...you can even index word and pdf documents."

      Really? That might come in handy. Thank you for pointing that out to me. I have a client that wants me to build a database of a bunch of .doc word files, and to have them searchable. The closest thing I came to that is some obscure perl module (http://www.wellho.net/solutions/perl-using-perl-t o-read-microsoft-word-documents.html).

      Anyways, what I mean is that not all projects are appropriate for premade content management systems. Especially for sites that provide a backend driven service.

      But for me, as a computer science student and hobbyist web developer, I just like making things from scratch, if I know how. Yes, I reinvent the wheel quite often, but I find it rewarding. Like, after finishing a forum-like website, I went and had a look at the source code for phpbb, and found that they used a lot of the same techniques that I did. It's nice to see that my first attempt at the concept is comparable to that of several years of evolution. :-)

      But yes, there are many sites that are just better off using a CMS. There's no doubt that they serve a purpose.

      - shazow
    88. Re:Advantages? by Anonymous Coward · · Score: 0

      If that is someone's biggest problem then they must be fucking brillant. Think about it.

    89. Re:Advantages? by 3.2.3 · · Score: 0

      After 6 yrs as a J2EE developer, I'd say you'd have to be braindead NOT to be using Plone for a web framework these days. It's everything Java was reaching for, all bundled up in a nice usable box.

      Python isn't about the elegance of the language or its syntax. It's what can be and has been accomplished with it.

      The documentation and ZODB nits are so two years ago. The documentation is great now. Not to mention the documentation did separate the men from the boys for awhile. We read the source code and are the better for it. And ZODB is way more bulletproof than any RDBMSes. Geez, our Oracle "cluster" crashes weekly. Our ZODB has never had a loss of data or unscheduled downtime.

      The notion that Zope is monolithic is pretty ignorant, as well. Zope is highly modularized.

      CPAN? Give me a break. A more helpful community could not be found than that which I find in Plone. And they aren't a competition to see who can write the most arcane one line program.

    90. Re:Advantages? by flacco · · Score: 1
      webware is a lot like a tomcat servlet engine. cheetah is a lot like velocity templates.

      webware has its quirks but i'll never write another java servlet app again if i can help it.

      --
      pr0n - keeping monitor glass spotless since 1981.
    91. Re:Advantages? by Anonymous Coward · · Score: 1, Insightful

      It is more verbose when doing simple operations. But I like to think that more complex operations fall together more easily.

      I've done medium-to-large projects (over 50,000 lines) in both Java and Python, and I've had exactly the opposite experience.

      For small things, Java is more verbose, but if you're new to programming you kind of accept it. If you've been programming for a while maybe you say "oh, but it'll scale well, so for big projects it's probably a win".

      For big things, Java is more verbose at each level, and when you add it all together it's *ridiculously* more verbose than the same thing in Python. Some things, like Java's weak string handling, you can work around (everybody I know has their own StringUtils class), but other things like "ints are not objects", or "3 common yet incompatible array types" you simply can't ever escape.

      I've learned that complex things are made up of a lot of simple things. If you can't do simple things simply, you sure won't be able to do complex things simply, and maybe not at all.

    92. Re:Advantages? by CastrTroy · · Score: 1

      I don't see how making you put everything in an object makes it any harder to do simple programs. In the example, the author put the main function in a different class than the other function. But this was completely unnecessary and was only done to make Java look extremely verbose. You could just as easily make Java look like C, by putting all your functions in one class.

      The other thing, is taht when indenting is forced in some manner, there is no way to stray from it. This can be both good and bad. Sometimes you don't need your indenting to be a certain way. I know these cases are few, but it's nice to be able to format your code as you want to, without having it forced on you.

      Even the classes are proper objects? well I hope so. A class is an object.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    93. Re:Advantages? by Anonymous+Brave+Guy · · Score: 1
      I don't see how making you put everything in an object makes it any harder to do simple programs.

      And therein lies the problem.

      Not everything is an object, and there are many powerful design concepts that do not have the word "object" in their names. As other posters have pointed out, if you can't even do simple things simply, you're never going to do complex things even close.

      You wrote in your previous post:

      just having OO as a new feature, like C++

      OO isn't a new feature in C++; it's simply not the only design feature in C++. This is an advantage. Trying to force everything into objects artificially is not.

      And from this post:

      A class is an object.

      Not necessarily. In general classes are types, while objects are instantiations of types. It certainly is possible for classes to be instances of some higher order type themselves, but this is not a necessary requirement to support OO as it's usually defined.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    94. Re:Advantages? by Anonymous+Brave+Guy · · Score: 1
      Actually, they're taking lambda out of python.

      But aren't we left with things like list comprehensions instead? I'm not sure that's an improvement: you've removed concepts that are perhaps unfamiliar to many programmers, but powerful once you understand them (a lambda construct, closures, etc.) and replaced them with what are essentially watered-down special cases with some neater (to some eyes, at least) syntactic sugar, but without the underlying power. That might make learning the language easier initially, but it reduces its effectiveness as a serious programming tool.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    95. Re:Advantages? by Anonymous Coward · · Score: 0

      I don't care how helpful the community is.

      If I have to _ask_ to community anything, then it has failed.
      I should be able to learn all I need to know by reading the documentation.

    96. Re:Advantages? by Anonymous Coward · · Score: 0

      > Are people trying to edit Python code with Notepad or something?

      Well actually, yes. Or vi (not vim). Or nano. Or a web edit box.

      Works dandy for perl and php.

    97. Re:Advantages? by Anonymous Coward · · Score: 0

      Too Many!
      http://www.python.org/moin/WebProgramming
      http://www.boddie.org.uk/python/web_frameworks.htm l

      Developing web applications in Python is LOT more painless than anything in Java. There are multiple frameworks for almost every style, except maybe ASP.NET/JFaces style.

      My personal favorite is CherryPy. Keep it simple.

      If you are Tomcat type, try mod_python.
      If you are JBoss type, try WebWare.
      If you just like to complicate things from your Java roots, choose Zope :-). Just kidding.

    98. Re:Advantages? by Anonymous Coward · · Score: 1, Interesting

      > java.io.File myFile = new java.io.File("Some file Name");

      That gives you a file handle. Now return every line in the file starting with "DEBUG> " into an array. This is ONE line in python and doesn't even require a variable.

      [line for line in file("some file name") where line[:6] == "DEBUG> "]

      Good to know java got foreach syntax. Welcome to the 1970's, Java.

    99. Re:Advantages? by gonkem · · Score: 1

      https using client certificates

    100. Re:Advantages? by MemoryDragon · · Score: 1

      Actually I never really liked lambdas the way I hate inner classes in java, they are unnecessary constructs if you add serious introspection to a lanuguage on language level which is a far better concept. (the best example for the power of introspection is ruby rails where you simply derive a class from a database table and instantly have the accessors in the class without writing any code)

    101. Re:Advantages? by Phrogz · · Score: 1

      If you don't already know Python, I suggest (as an alternative) Ruby ( http://www.ruby-lang.org ) and Ruby on Rails ( http://www.rubyonrails.org ). I personally prefer Ruby as a language over Python. I wanted to learn a new language for server-side web programming, and took a month to do my research on all sorts of dynamically-typed languages. Though currently less popular in the US than Python, Ruby is much better -- in my opinion. (No language flame wars, please.) I almost chose Python purely because of Zope, but after looking into Zope for a week I didn't "get it", and I went with Ruby. And then...Ruby on Rails came out. Holy cow, it is AMAZING. It's like programming with butter. (Whatever that means.) All yesterday as I worked with it I repeatedly caught myself grinning because it was so easy, so simply, and so joyous.

    102. Re:Advantages? by MemoryDragon · · Score: 1

      Actually AOP can help dealing with checked exceptions in a proper manner in quite a good way. For instance you can write interceptors which basically encapsule your data accessor methods/business methods in a transaction scope automatically without touching any code and add a proper transaction handler to that without touching the core code.

      Also you can write interceptors which deal with certain transactions in a clean way, no matter where they are thrown and when. Getting the transaction handler mess out of your algorithms is really one of the points where AOP can show its strenghts.

      I personally hate unchecked exceptions, because once a program becomes bigger you run into trouble because you never know what is goint to be thrown around your ears, and in the end you end up with catching every exception there is on earth at certain points which could trigger unwanted sideeffects in the subsystems. (I once had such a case caused by a guy who never really caught up with the concepts of exceptions at all and suddenly had to program .Net (coming from the VB side))

    103. Re:Advantages? by 3.2.3 · · Score: 1

      If I have to _ask_ to community anything, then it has failed.

      Then I guess they've all failed. Including CPAN.

      I should be able to learn all I need to know by reading the documentation.

      You can. People still have questions and work together anyway. Most people who ask questions get pointed at documentation. There are just different ways of doing that pointing.

    104. Re:Advantages? by _Sharp'r_ · · Score: 1

      Try Swish-e for indexing and searching word docs, pdfs, or anything else that can be converted to text.

      --
      The party of stupid and the party of evil get together and do something both stupid and evil, then call it bipartisan.
    105. Re:Advantages? by k8to · · Score: 1

      And if as a programmer you are unable to see the benefits of smaller amounts of code which express the same logic just as well, then you probably shouldn't be coding at all.

      Oh wait, I've just described 90% of all programmers. Hmm. No wonder software generally sucks.

      --
      -josh
    106. Re:Advantages? by k8to · · Score: 1

      Don't say "X is better". Say what specifically makes it seem better to you. Then your post develops meaning and worth.

      Regarding Zope, it is hard "to get". It's convenient if you fit into its abilities neatly. I'm not yet sure if that's a good enough reason to use it.

      --
      -josh
    107. Re:Advantages? by rsheridan6 · · Score: 1

      Read Guido's rationale for yourself. Apparently, Guido's vision is first and foremost to have something easy to understand, and he doesn't consider lambda (and other lisp-like features) especially powerful anyway.

      --
      Don't drop the soap, Tommy!
    108. Re:Advantages? by 31eq · · Score: 1

      This is a common problem. I think it happens when the remote site never responds to a request. Call

      socket.setdefaulttimeout(secs)

      before using urllib2 and all should be well.

    109. Re:Advantages? by thetoastman · · Score: 1

      I don't find it easier to program in python. There are several reasons, and I'll give you a small summary of each.

      • Block indentation syntax - ie., whitespace
      • Line continuations
      • Language documentation
      • Module installation
      • Inconsistent interface patterns

      I realize it's a matter of preference, but I do not like the block syntax of Python. I find the resulting code difficult to parse. Whitespace errors are really tough to track down, especially in editors that do not support Python well.

      The language (and especially class) documentation leaves a lot to be desired. Finding method and method signatures is painful. Different module writers appear to use different conventions. The end result is that I have to parse through a lot of documentation to find exactly what I'm looking for.

      Module installation is scary. While more and more modules are supporting separate build and install steps, many still do not. There is no standardized test step that I have found. I basically have to install modules and hope that they work.

      Some modules come with tests, while others do not. I recently ran a batch of tests on a production module and got five percent failures. At this point, I don't know if I should rely on any of the module's functionality without careful examination of the code.

      One of the major issues I have with Python is that modules performing similar tasks don't have similar methods and method signatures. Database modules are especially unpleasant to use. I am not looking forward to migrating code written against MySQL to work with PostGreSQL. While there is a DBI PEP, virtually no one uses it, and it hasn't been touched since 1999.

      I just tried building the latest version of wxPython. Build documentation is incorrect (significantly at several points), entire libraries don't compile (OpenGL), and many of the demos fail to load. All this was so I could install SPE and have an editor to do a better job of whitespace checking (see above).

      In short, I'll revist Python from time to time. However, I don't think the state of the language is quite there yet.

    110. Re:Advantages? by Anonymous Coward · · Score: 0

      I would have loved a C compiler that didn't use braces, but used indentation instead. Man, that would have been glorious. Sigh.

      Write an IDE or editor that converts between proper syntax/braced code and indented code. Then you can write C "python-style" and still have the right syntax stored for the compiler. I considered doing this for the "wah wah I hate significant whitespace" anti-python crowd, until I realised they were just whiners, so why bother? No need to allow ugly python code, but C is such a mess, one more coding style couldn't hurt ;)

    111. Re:Advantages? by BasilBrush · · Score: 1

      I'll give it a try. Thanks.

    112. Re:Advantages? by Shazow · · Score: 1

      Thank you, much appreciated.

      Preferably, I'm looking for somethnig that can be run on a proprietary webserver. Like using php or something of the sort. (Since this will have to be done dynamically, and loaded into a MySQL database.)

      - shazow

    113. Re:Advantages? by Anonymous+Brave+Guy · · Score: 1

      Do you have a reference, please? I've seen various excerpts attributed to Guido, but without seeing the context they weren't worth much.

      In particular, a simplicity argument in a programming language is compelling, whatever the target market for the language. However, I find it hard to believe that anyone competent enough to design a successful language like Python doesn't appreciate the power of lambda and related concepts.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    114. Re:Advantages? by jaydonnell · · Score: 1

      Are you sure it's a problem with urllib2 and not the site. Does it throw an exception or just stop?

    115. Re:Advantages? by rsheridan6 · · Score: 1
      --
      Don't drop the soap, Tommy!
    116. Re:Advantages? by fingerfucker · · Score: 1

      My only experience of web progamming in Python is the client end, for web-scraping scripts, and its great for that. The one problem I have is that once in every few hours urllib2 locks up whilst trying to get a page from a particular site.

      Assuming that the most likely possibility why you are experiencing such a serious problem with Python (your lack of competence/experience) is not true, and assuming this problem is not something that is happening only in your environment but actually happens to other people too, isn't this proof that the whole "Python is making it in the enterprise environment" a bunch of wishful thinking ?

      BTW, I RTFA and there is no real evidence cited as to who those enterprises are (beyond the ones mentioned in the text of the /. post, which were known already).

    117. Re:Advantages? by MemoryDragon · · Score: 1

      Lambdas are not really that amazing, a good introspection (and/or) function pointer mechanisms functionality does a much better job than the language design wise hack lambdas, or inner classes. I appreciate the goal to make python a readable language, hence the similarities to object pascal in my opinion which was so far the ulimate language in readability (Python has not reached that leven and probably never will due to various design choices).

    118. Re:Advantages? by m50d · · Score: 1

      I just find it more useable. I agree that no option of variable declaration is a flaw, but it's the only one (well, and the colon) I've really found. I think it's been less successful than Java or anything else only because it's less marketed. Zope to me shows that it does work. Bottom line, I don't really do huge projects, but in general I find I can do the same thing in Python quicker and with less bugs than in any other language I've tried. This could just be me though.

      --
      I am trolling
    119. Re:Advantages? by m50d · · Score: 1
      It is necessary if you want your "Hello" class to be useable elsewhere. Yes you can put everything in one class, but you still have to worry about referencing instance things from a static context, for example, which becomes more problematic when you want to use some classes and some imperative programming.

      I agree with you here in principle, but I think the non-ambiguity of the indentation makes things clearer enough to outweigh the disadvantage from non-flexibility. The indentation just becomes part of the syntax, no harder than putting semicolons at the end of statements.

      Classes don't behave as objects in every language. Python lets you do things like subclassing the type class, so you can then create instances of this which are themselves classes. Not terribly necessary in most cases, but it shows the object system is very much a part of the language from the ground up.

      --
      I am trolling
    120. Re:Advantages? by Anonymous+Brave+Guy · · Score: 1

      Thanks for the link. I think I see where he's coming from now, even if I don't agree with him (for reasons not dissimilar to those in the comments at the end of the page you linked to).

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    121. Re:Advantages? by BasilBrush · · Score: 1

      Hurray! That seems to have fixed it for me. I've been suffering with that issue for months. I'd already looked for a timeout, but only in the urllib library. Thanks!

    122. Re:Advantages? by BasilBrush · · Score: 1

      No, it was a lack of Python network programming knowledge on my part. Someone else on the thread has suggested I add: socket.setdefaulttimeout(secs), which does the trick.

    123. Re:Advantages? by BasilBrush · · Score: 1

      It's sorted now, after I'd been putting up with it for months. When the site doesn't respond to a request, the urllib call never returns, never times out, so the app just stops. I'd looked for a timeout setting in urllib, but I didn't find one. Another guy on this thread has suggested socket.setdefaulttimeout(secs) which does indeed appear to fix the problem.

    124. Re:Advantages? by BRSloth · · Score: 1

      Just let me put this two together:

      Im not a coder my self, altough I hahe programmed in Java and in python, but I fail to see Python's advantages comparing to Java in an enterprise environment.

      and

      Python is fantastic for quickly building small apps, or even much larger ones.

      And there you have your answer. Python is awesome to build small apps. Then you build a small app over another small app. And then another small one over the last.

      Basically, we are seeing the come back of Unix practices: build one small app that does one thing but does it right and then allow it to talk to another applications.

      And, before you point that you could do the same with functions, just answer me that: how many programmers do you see spliting their code over several functions (that do just one thing but do it right)? There are a lot of people around there call themselves "programmers" (in any language) that don't know a bit about keeping the code clean for reuse or for maintance.

    125. Re:Advantages? by hey! · · Score: 1

      What's that difference between Python and Java in this regard if checked exceptions are generally considered a problem in Java and worked over to behave similarly to as in Python?

      Well, the main difference is in libraries, frameworks and APIs. Most Java libraries will force you to consider what to do with exceptions, which adds a layer of awkwardness.

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    126. Re:Advantages? by jaydonnell · · Score: 1

      I thought you said you were using urllib2 earlier, not urllib? Anyway, it depends on which version your using. For older versions of python you can use http://www.nongnu.org/bothans/pydoc/common.timeout socket.html You've already figured out how to do it for newer versions :)

    127. Re:Advantages? by BasilBrush · · Score: 1

      Yes, urllib2, that's the one I'm using. Cheers.

    128. Re:Advantages? by Anonymous Coward · · Score: 0

      They also suffer from a severe performance problem, and in a larger sense the "we are borg, you will be assimilated" problem most frameworks share of making you think about your application in terms of how it will fit the framework rather than being flexible enough to have the framework adapt to your application. The ArsDigita platform is a great example of this exact problem in the aolserver/tcl world.

  4. Good: by TeleoMan · · Score: 5, Funny

    Maybe it'll eat Archer's stupid little dog.

    --
    $6.21 is the number of the beast before sales tax. Meh.
    1. Re:Good: by Ziviyr · · Score: 1

      I'd rather it eat all of Phlox's stupid little creatures.

      No more fricking clones, no more transplanting bits about, heck, eat the doc too, might get some decent eps while they suffer thorugh that...

      --

      Someone set us up the bomb, so shine we are!
  5. No such thing by RicardoStaudt · · Score: 5, Funny

    "Will we finally be able to code for living in a language that's not painful?"

    Dude, programming for the enterprise without the pain is like the Passion of the Christ without the crucifiction... It's Impossible.
    In that case, Perl should fit perfectly.

    1. Re:No such thing by AndroidCat · · Score: 3, Funny

      "Programming is pain, anyone that says different is selling something."
      - The Dread Programmer Roberts.

      --
      One line blog. I hear that they're called Twitters now.
    2. Re:No such thing by Anonymous Coward · · Score: 0

      Cut it out! I mean it! Anyone want a peanut?

    3. Re:No such thing by Anonymous Coward · · Score: 0

      Inigo: Fezzik! Fezzik! Listen. Do you hear? That is the sound of ultimate suffering. My heart made that sound when Rugen told me to port our Enterprise Resource Management sytstem to VB and IIS. The Man in black makes it now.

    4. Re:No such thing by Hyksos · · Score: 1

      Writing Perl is a pleasure... reading it is a pain ;)

    5. Re:No such thing by drew · · Score: 1

      The man in black?

      Yes, his CRM system is about to be deployed on a MySQL database. Who else has cause for ultimate suffering?

      --
      If I don't put anything here, will anyone recognize me anymore?
  6. python performance by khuber · · Score: 4, Interesting

    Python is a nice language, but it's excruciatingly slow. It's below Tcl on The Computer Language Shootout, which is telling.

    1. Re:python performance by Sweetshark · · Score: 4, Insightful

      The Computer Language Shootout is pretty useless - often there is a reference implementation in C and the task is to code the *same* algorithm in other language. This ignores the fact that there might be better ways to solve the problem in the other languages. Or in almost all languages. Just take a look at the fibonacci test - it a stupid useage of recursion, if your compiler doesnt optimize out all the duplication. Ok, that would be a nice feature, but it just shows "This language/compiler is good at optimizing bad written code".

      Also you can make the shootout say almost anything, for example if you also calculate the code lines in and weight pidigits with a 4 multiplier, Python comes up as the best of the "serverside languages" (Perl, Python, Java, PHP ..)

    2. Re:python performance by The+Famous+Brett+Wat · · Score: 4, Insightful

      I think that Python is supposed to be better in benchmarks not listed on that page, such as "mean time to correctly add a feature to unfamiliar code, written by someone who has since left the company".

      --
      proof, n. A demonstration that a conclusion is implied by certain premises and axioms.
    3. Re:python performance by ajs · · Score: 1

      Well, to be fair, TCL had a fairly decent model for getting speed out of a string-re-evaluation language. Of course, it was also one of the world's most painful languages to program in....

      I wrote a few largish things (all pieces of much larger things) in TCL. It was fun, but frustrating to debug, and annoying trying to keep levels of re-evaluation straight at times.

      Back to Python: work continues on Parrot-based Python which provides a very nice JIT compiler, and has demonstrated some execellent speed returns. Of course, it's all fairly early, but given the existance of Pugs on the Perl 6 side pushing Parrot development into overdrive, I expect to see a real-world-useable Parrot fairly soon.

      Ruby is also a nice choice if you're looking for a bit more performance in your HLL.

    4. Re:python performance by arevos · · Score: 3, Insightful

      I've never had any problems with Python's speed. It's fast enough for web applications. It's fast enough to use GUI toolkits. It's even fast enough for simple OpenGL demos (a shameless plug, I know, but it seemed relevant).

      If you come across a situation where Python is too slow for what you want to do, then Python can work happily enough with libraries programmed in C. If that's still not fast enough, then use a different language. But I suspect that for 95% of all programming tasks, Python is fast enough.

    5. Re:python performance by bani · · Score: 1

      if you feel you have better python code to perform a task on the benchmark, feel free to submit it.

      try http://shootout.alioth.debian.org/sandbox/benchmar k.php?test=mandelbrot&lang=all&sort=fullcpu=all for example.

      producing code speaks louder than complaining that the benchmark is useless.

    6. Re:python performance by Sweetshark · · Score: 5, Interesting

      If you feel you have better python code to perform a task on the benchmark, feel free to submit it.
      Actually I tweaked around with the code - but the rule of the game are just wrong. Just look at the fibonacci test. It requires you to do the stuff completely recursively - thats one of the rules. So you not only generate a huge return stack, you also calculate all the fibonacci numbers far too often. This is just braindead. A good requirement would say: "Calculate the nth fibonacci number". A simple solution would be to start from the beginning and not recursively calulate every fibonacci number bazillion times.

      Ok, the test description says that its task is to show the performance of recursion. But then they have to find a task where recursion is an merit - not a flaw. Otherwise you could claim your language is best because it has the best performing idle loops ....

    7. Re:python performance by Edward+Faulkner · · Score: 2, Insightful

      Computers are cheap.

      People are expensive.

      Writing in powerful languages like Python makes your people more effective. And most enterprise apps are not CPU limited anyway.

      --
      "The danger is not that a particular class is unfit to govern. Every class is unfit to govern." - Lord Acton
    8. Re:python performance by animaal · · Score: 1

      That depends on how good the documentation is. Consider the following Java and Python declarations:

      String readSome(File configfile, int numlines)

      def readSome(configfile, numlines)

      I know which tells me more. From the line of Python , what is "configfile"? A file object? A string filename? A file handle? Is there a return?

      Python may have advantages for hacking out code quickly, but better maintainability isn't an advantage it can claim.

    9. Re:python performance by bani · · Score: 1

      the mandelbrot test isnt recursive.

      care to try again?

    10. Re:python performance by afd8856 · · Score: 1

      My guess would be that a good example of Python used in real life for a fibonaci number generator would use a generator and calculate the number "on demand", something like:

      x = myFibonaciGen()
      for i in range(10):
      print x.next()

      This is what a python version would be like in "real life" situations. Not generating the whole thing at once.

      --
      I'll do the stupid thing first and then you shy people follow...
    11. Re:python performance by arevos · · Score: 2, Informative
      One can calculate the nth fibonacci number using Binet's formula, so that particular test would be of no use:
      import math

      def fibonacci(n):
      phi = (1 + math.sqrt(5)) / 2.0
      neg_phi = (1 - math.sqrt(5)) / 2.0
      return int((math.pow(phi, n) - math.pow(neg_phi, n)) / math.sqrt(5))
      But I do understand your point. Different languages have different ways of doing things. The most efficient algorith in C, for instance, may not directly translate to the most efficient algorithm in Python.
    12. Re:python performance by goombah99 · · Score: 4, Informative
      Yes python falls in this weird crack between a scripting language and a high performance programming language. combines the slowness of perl with the inconvnience of structured programming. Its too structured and takes too many steps to be a good scritping language and too slow to be a programming language.

      That being said I am enjoying it. I recently found I was writing a perl program that became unweidly in its comlpexity and impossible to maintain. So I converted to python. My reason for doing so was the existience of a nice matlab packages that allowed me the ability to recycle matlab code and make nice graphs. The syntax in python is cleaner with lets me do more complex array manipulations in the scientific envirnoment.

      On the other hand I note that this syntactic sugar is simply a coating. FOr example, python implementes obects via an underlying hash just the same way perl does. But it hides it from view. Thus you get less flexibility in objects than perl and no real ability to optimize their speed since the access method is frozen in the syntax.

      other things that trouble me are its seeming incompleteness of many of its metafors. For example, variables do spring into existence upon assignment but they dont auto initialize. Thus simmple things like counting the occurence frequency words in a file becomes a hassle since you have to either explicitly initialize every hashkey value to zero, or use one of the slow accessor methods (like .get()) that introduce huge perofrmance penalties. And the method of doing this is different for arrays, hashes, and scalars. auto-instantiation is somewhat dangerous too since a typo can now become an error without some means of declaring a variable name was meant to exist (e.g. the perl "my" statement).

      Related to the lack of auto-initialization is the tendency to rely on the crutch of throwing exception rather than returning default values or signals that allow the progammer to decide if it's worth throwing an exception. I find I end up wrapping too many inner loop clauses in "try" statements. If operations that failed simply returned "None" or zero as appros many things could be simplified without any loss of ability to use exceptions properly.

      other incomplete features are a lack of consistency on when an intrinsic operation is done in-place or returns the result. for example .sort() is done in place while .ltrim() is not. While one might wish to argue that space issues can require in-place operations, it woul dbe better to detect when an operation can be done in place from the syntax: a = a.sort() should be done inplace. b = a.sort() should not modify "a".

      typcasting also seems to be incomplete as well. Take for example the casting of strings to integers. try this: i= int(45.3); i = int('45') ; i = int('45.3'). The first two casts work. the last one is an error. Why? I note .atoi() also fails in the same way.

      My final lament about unfinshed python is the screaming lack of a decent syntax chekcer. Too many of its errors occur at runtime. It's weird that its the low level syntax of python that seems so unbaked. The high level imports are luxurious indeed and are a major attraction of the language. Having a conveinent operation like "shelve" for persistence takes enormous pain out of coding (now if 'shelve' could just use objects rather than olny strings for keys it would be complete).

      My hope is that someday python will take advantage of the syntactic sugar to imlpement objects in a faster way under the hood.

      all in all I do like python because it's a lot simpler to get the job done than Java or C++. If you know perl then python is useless as a scrpting language (sadly pathetic really) but if you dont know perl then python must seem like a fantastic scripting language if you are coming from C++.

      --
      Some drink at the fountain of knowledge. Others just gargle.
    13. Re:python performance by Sweetshark · · Score: 1

      Dont you get the point?
      Its not about recursion. Its that the requirements are too restrictive to paint a realistic picture of the performance.
      About the mandelbrot programm: The python code doesnt look to bad at first glance, and the rank (13) of python in that particular test isnt too worrying. Python get its worst ranks in the ackermann (45), fibonacci (47) and random tests (42). The first two tests require the useage of recursion (I dont know if the ackermann function can be calculated non-recusively right now), the random test requires the exact reimplementation of a C algorithm and thus prohibits the usage of pythons native API.

      So the shootout is a nice idea, but nothing to make decisions on without deeper analysis.

    14. Re:python performance by Anonymous Coward · · Score: 0

      I too have never had a problem with Python's speed but I have not written any serious applications in it. The way I look at it is that there are two problems with Python's speed- it is easy to write slow code in Python and it is rather telling that the rule of thumb when you need more speed is to re-write the speed critical parts in C.

    15. Re:python performance by arevos · · Score: 1

      I can't think of many instances when one would have to rewrite a part in C. I do suppose that if you were using Python to develop a 3D game, then you might want to write the engine in C. But I can't think of many other cases when you absolutely need the speed of compiled C.

    16. Re:python performance by Anonymous Coward · · Score: 1, Interesting

      If you use a lazy language like haskell, you can recursively create an infinite stream of the fibonnacci sequence. It takes 2 lines, and you'll get performance similar if you wrote it in C++ depending on compiler.

      fibs = 0 : 1 : join (+) fibs (tail fibs)

      join f (x:xs) (y:ys) = (f x y) : join f xs ys

      now isn't that just way too easy?
      If you're not familiar with the language, check it out. And if you're confused by the infinite stream, there's no problems with infinite loops as long as you use "take" to get the 0-nth item, or "!!" to get the nth item

    17. Re:python performance by Anonymous Coward · · Score: 0

      That's great. Now try to describe how basic I/O operations work in Haskell to a non-PhD.

    18. Re:python performance by Anonymous Coward · · Score: 0

      I totally agree.

      There is a saying in the Lisp world, "It hard to write a slow C program and it is easy to write a slow Lisp program." Of course, it is possible to write fast Lisp programs but it requires more of a conscious effort (I oringally only had only "effort" but that is misleading because it is not hard to write fast Lisp programs it is more a matter of knowing what not to do). I think in this respect that Python is much the same way.

      Now the thing is that you don't hear people say Python is fast. Maybe you hear "fast enough" but that is saying that it is slow but acceptable. I don't like the idea of C-modules and think the fact that a lot of Python people rely on them is a wart.

      The good news is that current Python systems are not exactly optimized for speed so it could get a lot better in the future. I do think that a really fast Python system is possible- it just does not exist yet because any current Python system that is useable is more concerned with being portable.

    19. Re:python performance by Waffle+Iron · · Score: 1

      Neither declaration tells you enough to actually use that function. Since you're going to have to read the documentation and/or source code anyway, you might as well use the nicer language.

    20. Re:python performance by Bob9113 · · Score: 2, Interesting

      And most enterprise apps are not CPU limited anyway.

      Say what? You must be living in a very different world than I. If it's an enterprise app, then it has a few thousand internal users. Multiply a few seconds by a few thousand people by a few times an hour by a few dollars per hour. Performance matters. Middle of last year my company pulled two people off their primary project to add a feature that saved our primary users two mouse clicks. Those 4,000 users now save 3 seconds, 10 times an hour, 8 hours a day. It's like getting an extra 33 employees for free.

      Now, I hasten to add that performance isn't the only thing - if it takes three extra months to add a new feature then you've got to multiply 3 months by all those people not doing what they could be doing with the new feature. But claiming it's a non-issue is shortsighted.

    21. Re:python performance by afd8856 · · Score: 1

      Related to the syntax checker... I use boa as IDE and that has an integrated syntax checker, and it highlights your error in the status bar.

      --
      I'll do the stupid thing first and then you shy people follow...
    22. Re:python performance by animaal · · Score: 1

      But we should make our code as readable as possible. My point was that we can understand more about the method from reading the Java declaration than from the Python declaration. By your logic, since we have to read the documentation anyway, we might as well define the method as

      def aa1(aa2, aa3)

    23. Re:python performance by dynamol · · Score: 0

      yes you are right...but no you are not. Not worrying about performance is what brought us much of today's current bloatware. performace matters in many areas...I am a scientific software coder...but there are plenty of other applications were it matters. And besides that you can't code in Python any faster than I can code in C++...you wanna know why? Because I probably know C++ as well or better than you know Python...the language wras really must quite. All languages have there place...my favorite language to dink around with is Ruby...would I even consider writing a large scale distributed scientific application with Ruby? Hell No. Anyway that is nothing more than my totally worthless opinion.

    24. Re:python performance by Waffle+Iron · · Score: 1
      Nobody would write mandelbrot inner loops in Python for anything other than prototyping. That 5 lines of code belongs in an extension library.

      The vast majority of programming in this world is *not* bit-banging like mandelbrots. This is especially true for the types of programs that you actually get paid to write.

      It's almost never necessary to operate at that level in Python because it provides native code libraries to handle low-level operations. Skilled Python programmers know how to use the libraries to do the heavy lifting for them.

    25. Re:python performance by colinrichardday · · Score: 1

      In the ruturn, does int truncate or round? In the former case you may get the wrong answer.

    26. Re:python performance by Anonymous Coward · · Score: 0

      The problem is not that there are no socalled syntax checkers. The problem is that python syntax leaves itself open to syntax problems that cant be diagnosed till run time. Or worse, that are not syntax errors but are logical errors. One is forced to use external heuristic checkers like Lint or things built into editors to do what should be part of the language design.

    27. Re:python performance by Waffle+Iron · · Score: 2, Insightful
      My point was that we can understand more about the method from reading the Java declaration than from the Python declaration.

      At the expense of having to write twice as much code, adding endless typecasts to your code, wading through endless documentation covering redundant overloads that handle different types, requiring a separate compile step, installing a VM that uses 10X the disk space and memory, and having only one available programming technique, OO, without other useful ideas from methodologies like functional programming.

    28. Re:python performance by bani · · Score: 1

      so in other words instead of writing your task in a few lines of straight C, you'd write it in a bunch of straight C in an extension library and then use python to glue it together.

      tis strange how virtually none of the widely used python applications do this though.

      of course if you care to submit a mandelbrot which uses native libraries to do better, i'd love to see it.

    29. Re:python performance by Berfert · · Score: 1

      You're making his point there. Human time is expensive, CPU time (generally) is not. The feature you mention saved Human time, not CPU time. As an example more in keeping with the argument, consider a program that has to parse log data and aggregate counts. It could be written in langauge X and take 30 minutes to run, or it could be written in Y and take 3 minutes to run. If log data comes in once an hour, then both languages work "fast enough". Now, if it takes 3 months to write the code in X, and 3 weeks to write it in Y (a realistic estimate for something like C vs common dynamic languages)... it's obviously a huge win to write it in Y. The fact that many languages Y tend to more maintainable than the comparatible X is an added bonus.

    30. Re:python performance by Anonymous Coward · · Score: 0

      >>the language wras really must quite. All languages have there place...

      - language *wars*
      - must *quit*
      - have *their* place (FFS!)

      >>my favorite language to dink around with is Ruby...

      So lay off 'dinking' around with the English language because you're doing my head in.

    31. Re:python performance by platypus · · Score: 1

      Huh?

      cPython itself (the standard python) has all the performance sensitive stuff written in C, also Zope, asyncore for asynchronous socket handling (now part of python) is written in C, python is used as a scripting language in a lot of commercial game engines, there's wypython, a wrapper for wxWidget (written in C++), there's Boost.Python, ctypes for working with native c-types in python, numpy, scipy etc. etc.
      See http://www.enthought.com/downloads/downloads.htm#d ownload for a python distribution containing a lot of stuff performance intensive stuff where core parts are coded in C.

    32. Re:python performance by arevos · · Score: 1

      Truncate. But it shouldn't matter except for very large values of N, because it's just to remove the slight rounding errors one gets when... Come to think of it, it should really round. Otherwise 4.9999999999999999 would come out as 4. Well, slap a 'round' in before the int, and it should all be okay :)

    33. Re:python performance by Anonymous Coward · · Score: 0

      lol, wypython eh. we tried using that once. buggy and useless.

      and once you start using a bunch of addon libraries uh oh, your portability goes to shit as all sorts of mutual incompatibilities arise on different platforms. use anything other than core python libraries and all of a sudden you can forget cross platform python.

      the same can mostly be said of perl with addons but perl is somewhat more mature in this respect.

    34. Re:python performance by platypus · · Score: 2, Funny

      Those 4,000 users now save 3 seconds, 10 times an hour, 8 hours a day. It's like getting an extra 33 employees for free.

      Did a consultant compute that number?

    35. Re:python performance by animaal · · Score: 1
      having to write twice as much code

      But some of that extra code is usefully descriptive (parameter types, etc), and some is due to the flexability of the class libraries, e.g. new BufferedReader(new FileReader("a.txt"))
      Granted, some is also longwindedness.
      adding endless typecasts to your code

      Undoubtedly. J2SE 1.5 improves things, but I still find it unsatisfactory.
      wading through endless documentation covering redundant overloads that handle different types

      This is a question of balance, that can apply to either technology. Either you write multiple versions of your method for each possible set of parameters, or you write a single method that accepts a more generalised parameter set, and have the internals of the method sift through the parameter types.
      requiring a separate compile step

      I like my compile step. It tells me before runtime that I'm passing the correct object types ot my methods, that I haven't accidentally added a bracket, or accidentally put 'ccccccc' at the end of a line. It doesn't catch all errors, but it helps.
      installing a VM that uses 10X the disk space and memory

      For enterprise software, that's not an issue. Besides, for running desktop apps, the latest JRE is around 15MB, the latest Python install is about 9MB. There's a difference, but not a lot.
      having only one available programming technique, OO, without other useful ideas from methodologies like functional programming

      I think Java handles OO better than Python. Python's OO feels like it was an afterthought. Python handles functional better than Java. My own opinion is that OO works better for large apps, functinal works better for smaller scripts or apps.
    36. Re:python performance by dynamol · · Score: 0

      LOL. English is my least favorite langauge to code in!!

    37. Re:python performance by arevos · · Score: 1

      I used to use Perl extensively. Now I hardly ever do, except in the case of a shell-script substitute. I find that Python programs tend to be easy to read. They feel less hacky.

      However, I think you're correct about sort(), and int() does indeed fail with strings representing floating points. But I've never found the practice of exception throwing in Python at all objectionable, and I've never had an experience where I've had to use 'try' too much.

      The lack of auto-initialisation is of debatable worth. I've always used 'use strict' under Perl; initialising one's variables is preferable to plucking them out of the ether - at least in most circumstances.

      As for the slowness of Python, I've never come across a situation where it would be noticable. Unless you're trying to design a cutting edge 3D game engine totally in Python, I should think Python's speed wouldn't be a problem.

    38. Re:python performance by Wavicle · · Score: 4, Insightful

      Ok, the test description says that its task is to show the performance of recursion. But then they have to find a task where recursion is an merit - not a flaw.

      Can you establish that more fully? How is testing say, a recursive-descent parser, going to be a more valid test of recursion than a recursive solution for fibonacci numbers?

      Fibonacci is convenient because you get lots of recursive calls while only hitting the stack, and no integer overflow. If you were to use a recursive parser and python ended up slower than the others, you could easily blame it on the non-recursive work you were doing. The fibonacci example allows you to accurately describe the recursive performance without all that other stuff getting in the way.

      --
      Education is a better safeguard of liberty than a standing army.
      Edward Everett (1794 - 1865)
    39. Re:python performance by zorander · · Score: 1

      Have you used python recently (i.e. since 2.2 and new-style classes)?

      Java's OO lacks multiple inheritance, mixins, and metaclasses. I don't think that a language needs all three (You can often implement mixins with metaclasses and mixins effectively replace multiple inheritance, as seen in ruby), but there should at least be a metaclass mechanism for when higher-order classes *are* truly the right pattern.

      Also, if it's so object oriented, why are there primitive types? This is a real crutch of Java's type system and one that causes me to doubt whether it's completely an object oriented language. Also, why aren't classes objects? Why can't objects be introspected reasonably, efficiently, and without a complex API?

      Java needs answers to these questions before I'll consider it the "handle OO better than python".

      I'm an embedded python/ruby developer. I use both languages in situations where speed and predictability matter and so long as you write your code write, they excel. I couldn't even think of putting Java and it's massive standard library onto a compactflash card. It's just absurd.

      Also, while the install size of java and python are roughly comparable, the memory footprint is not. A simple "hello world" in java allocates 12mb of unique (non virtual) memory. Python weighs in at 2.1mb. This is hardly "comparable". Also keep in mind that the default python install is more comparable to J2SE than J2RE. I've gotten python and neccesary libs for an embedded app into a handful of megabytes. The java class libs are not so decoupled as to make that practical.

    40. Re:python performance by CrocketAndTubbs · · Score: 1

      Its called "The Scientific Method." One of the controls is the algorithm. Changing the algorithm would ruin the test.

      I haven't taken a thorough look at the shootout, but I do see many different tests. There would be where your algorithm's change. Perhaps you should send a fibonacci2 test to them and see if they would post it. The key being all the languages would have to implement your new, non-recursive algorithm to be fair.

    41. Re:python performance by covertbadger · · Score: 1

      While I agree with you that performance is still an issue, even in these days of 2GHz workstaions on every desktop, your anecdote is actually an excellent example of why languages like Python are often an advantage. Your performance gains were achieved not by getting the most out of every last clock cycle, but by streamlining the user interface. In this case, speed of execution was not an issue - the important thing was that two coders could go into the codebase, identify the area needing modification, and make the changes quickly and with confidence. In fact, you touch on this point yourself.

      As a code-monkey myself, in such situations I'd rather be dealing with Python or Ruby than C or C++. The important thing, always, is using the right tool for the job. C++ gets you high speed and flexibility at the cost of greater complexity, but if you're just responding to a button click every second or so, do you really need all that speed?

    42. Re:python performance by zorander · · Score: 4, Interesting

      I agree with a lot of what you are saying, though it doesn't tend to stop me from using python.

      If you want a language that's consistently unsurprising and surprisingly efficient, then try ruby. Performance is not a dream, but that's what compiled languages are for. It lacks most of python's inconsistencies and is really quite pleasant to work with. in ruby there are two sort methods, sort and sort!. One does it in place and one returns a new list. (the ! suffix for mutation and ? suffix for predicates is a gem. I'm pretty sure it was stolen from scheme. It really, really helps make your code clearer)

      I still find python more practical for large projects, though, because of the large library and potential for rapid development. I generally use python (possibly with C underpinnings) for larger apps and ruby (with its perl heritage) for scripting. Blocks are the greates when you're dealing with ssh sessions, opening and closing files/database connections, etc. As for per,l I've generally avoided after a few bad experiences trying to decipher six month old code. I really don't think it has a place when ruby has most of its features and enough of it's syntax along with the slickest object system around short of smalltalk.

    43. Re:python performance by Edward+Faulkner · · Score: 1

      But you just confused two issues: saving users two mouse clicks has nothing to do with CPU usage.

      And while I agree that saving users a few seconds can matter a lot, I challenge you to find a typical enterprise app where the CPU has to sit and run for seconds at a time.

      We're talking about the difference between an app that responds in microseconds vs milliseconds. It doesn't matter.

      --
      "The danger is not that a particular class is unfit to govern. Every class is unfit to govern." - Lord Acton
    44. Re:python performance by Surt · · Score: 1

      To counter your point, one might say that the Computer Language Shootout is very valuable, because it requires a particular style of implementation. By doing so, it helpfully requires that a language have good tools, rather than requiring good programmers. We all prefer to use a language with good tools, but hardly any of us have any choice in the matter of working with bad programmers.

      --
      "Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
    45. Re:python performance by Tim+C · · Score: 1

      I couldn't even think of putting Java and it's massive standard library onto a compactflash card.

      You'll be wanting to take a look at the micro edition, then.

    46. Re:python performance by rsheridan6 · · Score: 1

      Of course, no sane person would compute fibonaccis that way, but this test shows which languages are better at dealing with heavy-duty (non-tail) recursion. If you're a python programmer, you probably don't care about that and shouldn't put any stock in this particular benchmark, but some people care about this.

      --
      Don't drop the soap, Tommy!
    47. Re:python performance by Sweetshark · · Score: 1

      We all prefer to use a language with good tools, but hardly any of us have any choice in the matter of working with bad programmers.
      Ok, thats a good argument. Still it hurts to see the code being less elegant and efficient than it has too ...

    48. Re:python performance by Anonymous Coward · · Score: 0

      What are you trying to say?

      The original argument was that "line by line" translation of benchmark programs often makes no sense...

      And to illustrate that point with Mandelbrot test

      try replacing

      z.real * z.real + z.imag * z.imag > limit2

      with

      abs(z) > limit2

      (limit2 has to be set to 2. then)

      This simple change got me 40% speedup (and a better looking code as well)

    49. Re:python performance by Bob9113 · · Score: 4, Insightful

      Clearly everyone missed my point, so I'll clarify.

      I was using an example from the real world to point out why 3 seconds matters. In any significant application there will be some processes that are sufficiently complicated that the choice of algorithm or choice of language will lead to a 3 second delta one way or another. There will also be places where adding a UI shortcut will save 3 seconds.

      The real world example talks about UI shortcuts that can save those 3 seconds, and Python makes it easier (according to the common wisdom) to add features. Other languages are more performance centric, and make it easy to save those 3 seconds in operation intensive sections of the code.

      I wasn't arguing that Python is bad because it's not as performant. I was saying that both CPU performance and UI friendliness are important, so choosing between Python, Ruby, C#, Java, C++, C or any other language on the spectrum is a question of weighing values.

      Ferfucksake people, stop trying to be argumentative and start trying to understand what people are saying. We all claim to be so smart, is our only ability with our intelligence to pick nits? Or can we use our intelligence to seek mutual understanding?

      I mean, I can see why the media is turning into a bunch of ranting extremists - they're just a mirror reflecting our own horrible image.

      Feh.

    50. Re:python performance by Waffle+Iron · · Score: 1
      so in other words instead of writing your task in a few lines of straight C, you'd write it in a bunch of straight C in an extension library and then use python to glue it together.

      Exactly. Only a freshman CS student would think that the few lines in that mandelbrot algorithm are significant code. The vast bulk of the code in any real application would be for viewing, selecting rendering parameters, zooming, etc. There is no reason at all to write the UI, I/O or other management code in C.

      tis strange how virtually none of the widely used python applications do this though.

      What are you talking about? Most every Python app makes extensive use of the native library calls.

    51. Re:python performance by seann · · Score: 1

      great demo.
      I look forward to viewing the code.

      --
      I'm a big retard who forgot to log out of Slashdot on Mike's computer! LOOK AT ME.
    52. Re:python performance by Anonymous Coward · · Score: 0
      So use intelligent variable names. Partial hungarian would help, but I end up doing something like this:
      def readSome(fileConfig, intMaxLines) :
      (lowercase type, Captialized meaning, just like you did with the function name). It's not hard to name variables so that they're easily understood.
    53. Re:python performance by Anonymous Coward · · Score: 0

      For langauges, there is no silver bullet, so I won't debate whether Python is better than Perl or not. But there is one part of your post I'd like to clarify.

      The return values for for str.lstrip (which is what I think you meant by ltrim) and list.sort are consistent with the language design, as long as you understand what that design is.

      A string (type str) is an immutable data type--it is not possible to modify a string once it has been created. Therefore, any string method that seems to modify its object instance actually returns a new instance.

      On the other hand, a list (type list) is a mutable data types--it is possible to modify an object of this type after it has been created. Therefore, any list method that seems to modify its object instance actually does modify it (in place), so the method does not need to return a new instance.

    54. Re:python performance by Anonymous Coward · · Score: 0

      To make python attributes faster, you can do:

      class Foo(object):
      __slots__ = ['foo', 'bar']

      this converts the "hash" into an "array" internally, similar to the perl "use fields".

      The variable autoexistence is a bit ugly. For this purpose, people have written python code checkers that warn you for doing questionable things (such as accidentally overriding a builtin -- list = [1,2,3]... I agree that I'd like an explicit way to declare scopes.

      The fastest way in Python to do something like

      $a{$_}++ for @foo

      when @foo does not contain many unique keys is to do

      a = {}
      for _ in foo:
      try:
      a[_] += 1
      except KeyError:
      a[_] = 1

      The exception handling is faster than testing if _ in a or using the get() method.

      Python strings are immutable, therefore .strip() methods and such always return new objects. They are space-efficient. sort() on list returns None to avoid the ambiguity between b = a.sort() and a = a.sort(). Since sort() returns nothing it must be an in-place sort. In your example you suggest a very unpythonic thing, adding magic to language.

      Typecasts are logical. int(Float) is sensible, and we assume you meant that. int('12') is sensible, too: safe conversion from string representation to integer type. However, for int('12.3') to produce 12 is nasty because you lost the decimal fraction silently. (If you _really_ wanted that, type int(float('12.3')). Makes sense, and you're being explicit about what you want. The alternative is WORSE.)

      My hope, personally, for the future is that Python will look just like this dynamic language it already is AND that it will run faster (for instance, because it will be run by the CLR of MS .NET, see IronPython project). It's not really slow, anyway, for most purposes, and extending Python in C is really pretty nice, about as clean as I think it can be.

    55. Re:python performance by swimmar132 · · Score: 1
      I like my compile step. It tells me before runtime that I'm passing the correct object types ot my methods, that I haven't accidentally added a bracket, or accidentally put 'ccccccc' at the end of a line. It doesn't catch all errors, but it helps.
      1) A dynamic language would catch the second two thigs you listed during the parsing step. 2) Unit tests would catch the first one. Heck, in Ruby, if you're expecting a string, you could probably also pass in a file or an array and it would be fine. (i.e. duck-typing)
    56. Re:python performance by DeadScreenSky · · Score: 1
      Ferfucksake people, stop trying to be argumentative and start trying to understand what people are saying. We all claim to be so smart, is our only ability with our intelligence to pick nits? Or can we use our intelligence to seek mutual understanding?
      I agree with you here, but I also don't think starting your original comment with "Say what? You must be living in a very different world than I." was a good way to accomplish that then.
      --
      There is no excellent beauty that hath not some strangeness in the proportion. -- Francis Bacon
    57. Re:python performance by MrBlic · · Score: 1

      Thanks, this is just the issue that leads to a lot of premature dismissal of an essential programming language.

      In my mind, no one language is appropriate for everything that runs on the computer. You have some things that need to be as fast as possible and run in 'machine time', and then a lot of logic that happens in 'human time.'

      You need some things to be very fast like crunching lost of numbers mathmatically, rendering web pages, transforming live video streams, decoding ogg, or implementing opengl. C or C++ is the language of choice for these purposes.

      The rest of what runs on the computer is simply helping the user tell the computer when to run that fast code. It shows them images, watches them move the mouse and click on things, and responds. Huge amounts of logic are required for things that run in 'human time' and as long as it doesn't take over about 1/10 of a second for a satisfying reaction by the computer, then the language that implements it is appropriate.

      I also beleive that you can't have a language that is so high level that it's a pleasure to do high level things, and also be as fast as any other language.

      So for high level code, I don't beleive that there's anything more appropriate than Python. I've put together scripts that pull data from spreadsheets or xmlrpc data sources, run them through a SimpleTAL to create web pages, download data from ftp sites, zip all the data with the created web pages, and do crypto on the result in a very short period of time. It's really beautiful... and months later I can go back to my code and never worry about scratching my head trying to read it.

      I also use wxPython for most of my prototyping, and any app that I need to deliver quickly with a decent UI.

      I'm just getting into using SWIG to script some of the C++ I've written over the last few years, and it's really much simpler than I thought.

      I strongly beleive that a commerical product like WingIDE (a good example of a serious application written in Python in itself) with a good wxWidgets gui builder, web page template builder, and (harder) a seamless way of doing hybrid C++ / Python integration by automating SWIG will be the ultimate combination that unifies programmers that are spread out all over on other languages at the moment.

      It's really that good.

      --
      Celebrate Excellence!
    58. Re:python performance by zorander · · Score: 1

      Well seeing as python's standard library is perfectly adequate, why should I? Isn't the micro edition non-free as well?

      The point is, why should I deal with having a subset of the language's standard library when I can have the whole thing in a lot less space. The only thing I've needed extensions for is mbuff (shared memory with a kernel module) and the serial port (which, last I checked, is not standard in java). Is there a real advantage to using the micro edition? Is it really as small in terms of disk/memory usage as a stripped, minimalist python install?

    59. Re:python performance by k8to · · Score: 1

      If by autoinitialize you mean that variables which haven't been assigned are magically existent and assigned to zero, then sorry python lacks this bug.

      Regarding the object namespace/dictionary you can manipulate it directly if you've a good reason to see blah.__dict__. However, I wouldn't compare Python and Perl's object implementations to Python's detriment. Python's is useful, timesaving, and genearlly safe. Perl's is .. well.. sometimes useful.

      Regarding in-place vs not, the semantics of the in-place sort operator is designed to force you to be aware of this fact. Notably, it returns None. As for the usability of this function, it's probably the biggest python usability wart I've ever encountered, which says a good deal.

      Conversion functions are not casts! 45.3 is a number, "45.3" is a string. In the one case you are asking to change a float to an integer. I the other case you're asking to change a non-integer string to an integer. Yes it violates the principle of least surprise, but I wonder if this is a real-world problem. In a similar inconsistency with creating decimal/fixed numbers, a floating point number will generate an error, because it is fundamentally unsafe to do so. I wouldn't be surprised if there's a similar safety issue here, though obviously far less severe.

      What syntax problems have you encountered at runtime in any python 2.x version? I've only seen such things in python 1.5 and prior and only regarding trivial issues.

      --
      -josh
    60. Re:python performance by IkeTo · · Score: 1

      > Just take a look at the fibonacci test - it
      > a stupid useage of recursion, if your
      > compiler doesnt optimize out all the
      > duplication

      I think a good recursion test should be done only to a problem that really needs recursion, not toy problems like Fibonacci that you can do much better in other ways. And in such a test, those with compiler which tries to do funny things like automatic memoization will only get hurt. You can find a large set of such problems by just looking at the acm.uva.es archive.

      In such a test, Python *will* be graded poorly. But then, Python is not about speed of programs. It's about speed of reading and writing programs. And when all are off, you can always implement the performance critical part in C or C++.

    61. Re:python performance by Anonymous Coward · · Score: 0
      If by autoinitialize you mean that variables which haven't been assigned are magically existent and assigned to zero, then sorry python lacks this bug.

      admittedly there is some philosphy here as to what is best. But if one is going to go the route of autoinstantiation, and particularly having autoinstantiation without having a proper scoping mechinism (such as the perl "my") then you have already committed to this philosophy. Not having auto intialization to zero is thus a missing feature not bug avoidance. it's not like it will really prevent many coding problems given that typos already spring into existence from auto-initialization. Or maybe if I wanted to be fair I'd say it would prevent half of them. Autoinstantiation allows any typo to be an L-value. (typo = variable; compiles and runs in python) Autoinitialization allows any typo to be an R-value. variable = typo; is an error in python, but it's also not detected till runtime either).

      the proper thing to do I think in a dynamicly typed language is to declare the variables existanece and scope. Or at least to allow the user to do so if they wish. this elmininates both downsides and allows for both upsides.

    62. Re:python performance by JeremyALogan · · Score: 1
      We all claim to be so smart, is our only ability with our intelligence to pick nits?
      pick nits? most of us call it nitpicking...
    63. Re:python performance by arevos · · Score: 1
      Thanks :)

      In case you're interested in looking at the source, main.py is the best place to start to figure out what things do. Some interesting things to do are:

      Replace:
      solid = tree.Solid(rings, texture.load("data/bark.jpg"))
      With:
      solid = tree.Wireframe(rings)
      Or:
      solid = tree.WireRings(rings)
      Or:
      solid = tree.WireLines(bones)
      To remove the random elements from the tree, comment out:
      skeleton.apply_func(bones, break_up)
      And then change branch_number(), angle(), length() and make_polygon() to:
      def branch_number(depth):
      if 4.0 <= depth:
      return 0
      else:
      return 3.0

      def angle(depth, (number, total)):
      if depth == 0:
      return (0, 0)
      roll = 360.0 * (float(number) / total
      return (roll, 30.0)

      def length(depth, life):
      return math.pow(0.75, depth) * 0.75

      def make_polygon(life):
      return regular_polygon(int(10 * life) + 1, 0.07 * life)
      That should make it easier to see what the code is doing, without the many randomising gaussian functions getting in the way. The above functions are used to control the tree's formation.

      branch_number() defines the number of branches at any one depth (ie. the number of generations away from the root). In the above case, branch_number() will give each branch three children up to the fouth generation.

      angle() defines the angle that a branch differs from its root. In this case the yaw is always 30 degrees, and the branches are spread equally throughout the roll.

      length() defines the length of the branches based upon their depth and their life (number of generations until a branch tip).

      make_polygon() defines the encompassing rings that flesh out the tree. The number of edges and the radius of the ring decreses as the branch thins out to a tip (where life = 0).
    64. Re:python performance by k8to · · Score: 1

      Well clearly you don't actually know python. Python has scoping, it's just sane by default, so you don't worry about it. Explicit global is required if you want it.

      Thus you don't need this explicit declaration, and making variables zeroed by default is also not needed.

      --
      -josh
    65. Re:python performance by Anonymous Coward · · Score: 0

      Uh thanks for the insult. By the way thought you might like to know that declarative variable scoping is the number one requested feature in python and something guido is working on.

    66. Re:python performance by sjames · · Score: 1

      Thus you get less flexibility in objects than perl and no real ability to optimize their speed since the access method is frozen in the syntax.

      You don't really lose any flexibility. The details are available in __dict__, __getattr__, and friends. You're just not forced to consider them unless you actually need them.

    67. Re:python performance by Anonymous Coward · · Score: 0

      The access to attributes is frozen in the syntax. You must place all attributes in __dict__ (or __slots__), period. no excpetions. You cant use other methods for caching attributes. Sure you can map python onto perl eventually and many contorted statements later. But that's like saying all turing complete languages are isomorphic. Might as well program in fortran or brainfuck language then.

  7. Microsoft's involved? by The+Amazing+Fish+Boy · · Score: 3, Insightful

    I don't know whether to be happy or afraid.

    1. Re:Microsoft's involved? by m50d · · Score: 2, Interesting

      Happy. It's open, and could be a sign that MS is actually "getting it". Besides, it's already possible to do python under java, but IronPython looks better, and MS is employing the guy who does it.

      --
      I am trolling
  8. Did anyone else think... by lxt · · Score: 3, Funny

    ...Monty Python was merging with Enterprise? Now there's a show I'd like to see... :)

    1. Re:Did anyone else think... by m50d · · Score: 1

      Does this mean parker-stone are no longer going to be involved? Or is Monty Python helping them out? That would be sweet

      --
      I am trolling
    2. Re:Did anyone else think... by Anonymous Coward · · Score: 0

      IronPython is not as free and open as you think it is.

    3. Re:Did anyone else think... by Stormwatch · · Score: 2, Funny

      Yeah... to boldly say "ni!" where no knight had said "ni!" before!

    4. Re:Did anyone else think... by Spoing · · Score: 2, Funny
      1. ...Monty Python was merging with Enterprise? Now there's a show I'd like to see...

      "I wish to complain about this tribble what I purchased not half an hour ago from this very boutique." ...

      --
      A firewall can not protect you from yourself. Turn off what you do not need. Do not use the firewall to do your work.
    5. Re:Did anyone else think... by colinrichardday · · Score: 1

      It's just pining for the fjords of Rigel 7!

    6. Re:Did anyone else think... by m50d · · Score: 1, Informative

      http://www.fsf.org/licensing/licenses/license-list .html says you're wrong. It's almost exactly as free and open as Apache.

      --
      I am trolling
    7. Re:Did anyone else think... by LittleGuy · · Score: 1

      ...Monty Python was merging with Enterprise? Now there's a show I'd like to see... :)

      And my initial thought was that Eric Idle and Terry Jones could only improve on it.

      "Enterprise!"
      "Enterprise!"
      "Enterprise!"
      "It 's just a CGI...."

      "NO-body expects the Klingon Empire!"

      "Help! Help! I'm being assimilated!"

      "It's 8 O'Clock, and time for the Denebian Slime Devil on your Digital Box to explode."

      --
      Mod Karma -1: I sed bad wurds. If I cep my mouf shut, I wud be at riyses.
    8. Re:Did anyone else think... by value_added · · Score: 1

      Dear Sir,

      I wish to complain on the strongest possible terms about the previous post. Some of my best friends are Star Trek fans, and not one owns a tribble. And only a few own parrots.

      Yours etc.,
      Brigadier Arthur Gormanstrop (Mrs).

    9. Re:Did anyone else think... by Meester+Nice+Guy · · Score: 1

      Who needs a starship when you have a flying circus?

    10. Re:Did anyone else think... by LilMikey · · Score: 1

      ...Monty Python was merging with Enterprise? Now there's a show I'd like to see... :)

      Dude, Red Dwarf's been around for years!

      --
      LilMikey.com... I'll stop doing it when you sto
    11. Re:Did anyone else think... by lennier · · Score: 1

      Two words. Red Dwarf.

      --
      You are not a brain: http://books.google.com/books?id=2oV61CeDx-YC
  9. before RTFA by FidelCatsro · · Score: 0

    I had a mental image of a new member of starfleet with an odd name..

    However seeing python moving into the enterprise market would be grand .
    Python has really come on in strides in the past few years ,it is easy to learn and has a massive collection of librarys for many difrent things , infact i am suprised it has not happend sooner .

    --
    The only things certain in war are Propaganda and Death. You can never be sure which is which though
    1. Re:before RTFA by m50d · · Score: 1

      I'm not. The reason it's taken so long is the same reason java was so successful in the first place: marketing. There's no one marketing python to enterprises; the fact that it is succeeding shows superior quality will win out in the end. Good for Linux, no?

      --
      I am trolling
    2. Re:before RTFA by bigirondawg · · Score: 1

      the fact that it is succeeding shows superior quality will win out in the end

      Such as the superior quality of Token Ring, COBOL, and OS/2?

      --
      - Proofs of Sturgeon's Law Delivered Daily -
  10. Disclaimer: Newsforge is part of OTSG... by Anonymous Coward · · Score: 0

    and Cameron Laird is an unabashed Python booster who's been writing the same booster prose for years. You're actually arguing Python is ready for the enterprise because Cameron Laird went to a Python conference full of Python boosters and saw they were just like him?

    Timothy, you may want to check out the definition of "echo chamber."

  11. Toolsets by justanyone · · Score: 5, Informative

    I work at an Application Service Provider startup with 16 employees (5 developers) using Python (30K lines+).

    I have 6 years of Perl development plus another 8 in C. So, a newcomer to Python (about 2 months now), I have several reactions shaded by that experience:
    * Nice syntax: Not perfect, but very passable overall.
    * Love the no-brackets: Indentation as a means of delineating code blocks is great; there's no debate over where to put squiggly braces (the 'if test { statement; } stuff;
    * Immature toolsets: there are very few mature toolsets yet. We're using SQLObject, which is in version 0.6, as an object-relational-mapper. It's got some limitations and is admittedly not 'enterprise ready'. it's hard to compare to the Perl DBI because the dbi just is an interface and doesn't do mapping.
    * Lack of CPAN: the single most fantastic "tool" I've found in my programming career (15 years) has been CPAN. Got a problem? Someone has probably already seen it and started a solution. I know this is in the works for Python but the tools are not all there yet.
    * Syntax (bad): Lack of a requirement to declare vars before use. I really would like the ability to require that all vars are explicitly declared before being assigned to. it would help coding reliability.

    Just my 5 cents.
    -- Kevin

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

      Indentation as a means of delineating code blocks is great

      Ugh, kill me now

    2. Re:Toolsets by Anonymous Coward · · Score: 0

      >Indentation as a means of delineating code blocks is great

      Awesome! An even less readable method than {}'s I didn't think it was possible!

    3. Re:Toolsets by Anonymous Coward · · Score: 0

      Tried it? It works perfect for me. Using indentation you can actually see the structure of your code. If it looks good, it is good. No need to hunt down that missing bracket.

    4. Re:Toolsets by Anonymous Coward · · Score: 0

      Try Ruby instead. With your C experience you will find writing C extensions *much* easier in Ruby than Perl.

    5. Re:Toolsets by krumms · · Score: 1

      * Nice syntax: Not perfect, but very passable overall.

      I agree.

      * Love the no-brackets: Indentation as a means of delineating code blocks is great; there's no debate over where to put squiggly braces (the 'if test { statement; } stuff;


      This would save me from so many religious debates regarding other people's opinions of how my curly braces should be placed, it's just not funny.

      * Immature toolsets: there are very few mature toolsets yet. We're using SQLObject, which is in version 0.6, as an object-relational-mapper. It's got some limitations and is admittedly not 'enterprise ready'. it's hard to compare to the Perl DBI because the dbi just is an interface and doesn't do mapping.

      I've also found this to be the case, and I'm honestly surprised there isn't a more powerful object-relational data access framework for python. Even the basics of Hibernate would be great.

      * Lack of CPAN: the single most fantastic "tool" I've found in my programming career (15 years) has been CPAN. Got a problem? Someone has probably already seen it and started a solution. I know this is in the works for Python but the tools are not all there yet.

      I too look forward to something similar to CPAN for Python. Hopefully it's more useful than PEAR though (for which I've only ever found a use for two or three libraries)

      * Syntax (bad): Lack of a requirement to declare vars before use. I really would like the ability to require that all vars are explicitly declared before being assigned to. it would help coding reliability.

      To me, this would sort of be a waste of time - I mean, how do you suggest that would work? Something like:

      var name
      name = 'Bob';

      ? Python is dynamically typed, so declaring "name" gives us no further information about the variable "name" other than the fact it exists (which is pretty well obvious just by looking at the assignment). I sort of see where you're coming from, but I don't think this sits well in a dynamically typed language - which is why you don't see it in PHP, Ruby or Perl. You can do something like:

      my $var;

      in Perl, which is only necessary because everything's a global in Perl unless you explicitly say otherwise (which is nasty, IMO).

      One thing I could see a use for is automatic runtime type checking, but that's a whole other post.

    6. Re:Toolsets by Gorny · · Score: 1

      The Vaults of Parnassus is a great resource for Python stuff. http://py.vaults.ca/. It doesn't have a CPAN like interface for it though.

      Then there's the python http://www.python.org/pypi which afaik can easily be accessed through the setup.py from Python distutils. If it's not implemented yet it's not even that big of a deal with all the native http/url/xml from Python.

      I, for one, think a CPAN like interface to the PyPi or Vaults are great.

      --
      Alan Perlis once said: "A language that doesn't affect the way you think about programming, is not worth knowing"
    7. Re:Toolsets by Xrikcus · · Score: 2, Insightful

      You may not have arguments between programmers with indentation based delimitation. However it only takes one contributer to accidentally use tabs rather than spaces to indent, or vice versa, and the code can actually look fine but suddenly fail to execute correctly as the interpreter becomes unsure what the indentation levels are. Then of course how do you automate a fix? At least with bracketing one can run indent over the codebase to make it all consistent.

    8. Re:Toolsets by SamBeckett · · Score: 1
      * Syntax (bad): Lack of a requirement to declare vars before use. I really would like the ability to require that all vars are explicitly declared before being assigned to. it would help coding reliability.
      To me, this would sort of be a waste of time - I mean, how do you suggest that would work? Something like: var name name = 'Bob'; ? Python is dynamically typed, so declaring "name" gives us no further information about the variable "name" other than the fact it exists (which is pretty well obvious just by looking at the assignment). I sort of see where you're coming from, but I don't think this sits well in a dynamically typed language - which is why you don't see it in PHP, Ruby or Perl. You can do something like: my $var;
      Even if it was simply "var myvar" type declaration, it would end the problem of reading through someone else's code, seeing a strange variable name and having to scroll back up through the function to see if it is new or not.. VB is the same way, if you don't use "Option Explicit" (I hate VB with a passion), and it becomes very tedious to even maintain your own code. At least to people like me and grandparent who are used to coding in C and it's kin.
    9. Re:Toolsets by dossen · · Score: 1
      You can also "use strict 'vars';"
      dossen@leela ~
      $ perl -w
      use strict 'vars';
      $foo=42;
      print "$foo\n";
      Global symbol "$foo" requires explicit package name at - line 2.
      Global symbol "$foo" requires explicit package name at - line 3.
      Execution of - aborted due to compilation errors.

      dossen@leela ~
      $ perl -w
      use strict 'vars';
      my $foo=42;
      print "$foo\n";
      42
      Not saying that perl is perfect, but for the kind of language that perl is, it seems like a good idea to make requirements like declaration of variable scope optional.
    10. Re:Toolsets by Anonymous Coward · · Score: 0

      >in Perl, which is only necessary because
      >everything's a global in Perl unless

      Well using the strict option in perl forces variable declaration. All the perl guys I've learned anything from have always said to use strict. It's just good programming practice and catches errors.

      If you misspell a variable somewhere in Python, you must end up with two variables or something. It looks ridiculous. And no type checking, my god, are they honestly trying to help programmers or not? I don't understand Python, I guess.

    11. Re:Toolsets by Anonymous Coward · · Score: 0

      > Love the no-brackets: Indentation as a means of
      > delineating code blocks is great; there's no
      > debate over where to put squiggly braces (the 'if
      > test { statement; } stuff;

      Actually, the no-brackets feature is one reason why it'll never work in my organization where hundreds of people work on hundreds of projects and there's high mobility between teams. The squiggly braces issue really doesn't exist -- we all have the convention that if a file starts off with one convention, anyone modifying the file will preserve it. There are no standards with respect to tabs and spaces because people use different editors on different operating systems. If things go out of alignment (and they currently do with {} blocks ) because more than one person modifies a file using different editors, there's no way to re-align it. Worse, the entire meaning of a program can change transparently. Take this example:

      if somecondition:
      . . . dosomething()
      . . . dosomethingelse()

      If things go out of alignment, it becomes this:
      if somecondition:
      . . . dosomething()
      dosomethingelse()

      Now dosomethingelse() will always execute, and I won't know without a complete retest what went wrong. (Notice also that you can't post python code on most web forms because most of them strip away the leading spaces....).

      Personally, I think Ruby or Groovy or PHP are much better suited to the enterprise.

    12. Re:Toolsets by krumms · · Score: 1

      If you misspell a variable somewhere in Python, you must end up with two variables or something. It looks ridiculous.

      That's an uninformed rebuttal.

      If you misspell a variable name in Python for anything but an assignment, you'll get a runtime error. This sucks in a way, because you'll only ever discover this at runtime (i.e. Python's compiler doesn't see this IIRC, only the interpreter) but because Python makes no assumptions about the existence of a variable before it's required, it's not really possible to check this at runtime.

      It has the potential to cause issues in multithreaded code, but outside of that it rarely causes me any problems.

      And no type checking, my god, are they honestly trying to help programmers or not? I don't understand Python, I guess.

      So, uh, where's Perl's type checking? Carp::Ensure is the closest I've seen, and it's nothing that couldn't be done in Python - it's more like assert () with introspection.

    13. Re:Toolsets by krumms · · Score: 1

      This sucks in a way, because you'll only ever discover this at runtime (i.e. Python's compiler doesn't see this IIRC, only the interpreter) but because Python makes no assumptions about the existence of a variable before it's required, it's not really possible to check this at runtime.

      That last "runtime" should be "compile time".

    14. Re:Toolsets by viperblades · · Score: 1

      a solution ive used for python's lack of "use strict;" is to use dicts to store variables. granted im a newb coder and thats not a bullet proof method, but it normally allows me to detect mis-spelled variables. it also makes code more readable imho.
      cust_count = 6
      vars["customer count"] = 6

    15. Re:Toolsets by Ursus+Maximus · · Score: 5, Informative

      Kevin wrote:
      Syntax (bad): Lack of a requirement to declare vars before use. I really would like the ability to require that all vars are explicitly declared before being assigned to. it would help coding reliability.

      Actually, Guido von Rossum (the Creator of Python) is working on optional declaration of variables for a future version of Python. Although some Pythonistas are annoyed, it may give folks like you, Kevin, the best of both worlds. There is discussion on comp.lang.python about this from time to time, but it certainly appears as though Guido may take action soon;-))).

      Ron Stephens
      Python Learning Foundation
      http://www.awaretek.com/plf.html

    16. Re:Toolsets by Anonymous Coward · · Score: 0

      Love the no-brackets

      I love Python, but I hate the significant whitespace. Apart from anything else, it's an utter bugger to do web templates like PHP without resorting to crappy XML mixins or yet another crappy macro language.

      [SQLObject is ]hard to compare to the Perl DBI because the dbi just is an interface and doesn't do mapping.

      The Python equivelant to DBI is the DB-API. Any Python database module should implement that.

      Lack of CPAN

      The equivelant here is the vaults of Parnassus. Admittedly, CPAN has a bit of a head start :).

      Probably the biggest thing going for it in Python's favour is it's sheer productivity. I learnt Python back in 1999, and then let it go for a few years. I picked it up again last year, and was absolutely amazed at how much I was able to achieve in just a few hours.

      You know that feeling you get sometimes when you write a thousand lines of code, and it all compiles cleanly and runs perfectly first time? You get that feeling a lot more in Python than any other language I have ever used.

      I'm not sure exactly what it is about Python that brings this productivity boost, but it's real and it's worth learning Python just for that.

    17. Re:Toolsets by rakanishu · · Score: 1
      If you misspell a variable somewhere in Python, you must end up with two variables or something. It looks ridiculous.
      When coding in Perl, I always use strict, but I also check the syntax before trying to run it (perl -c myscript.pl). In python, I use pychecker which checks the syntax, looks for variables that potentially could be misspelled, and some other cool things.(pychecker myscript.py)
    18. Re:Toolsets by hey! · · Score: 1

      Python is dynamically typed, so declaring "name" gives us no further information about the variable "name" other than the fact it exists (which is pretty well obvious just by looking at the assignment).

      Not true -- or at least if it's true, it's true in a trivial, tautological sense. What is absent is the ability to confirm the programmer's intent that a variable be brought into existence, independent of the opinions of his keyboard skills:

      MyVariable = 2
      MyVaraible = MyVariable^2
      print MyVariable

      Of course, the programmer intended to print "4", but gets "2" instead, becuse of a typo on the second line. This is not a purely academic issue -- this class of bugs is very common in languages which allow it. It's a devestating class of bugs because in a complex program it may not be apparent, as it is in this case, that something is wrong by doing a simple inspection of the output.

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    19. Re:Toolsets by platypus · · Score: 1

      I'm not sure, but have you looked at APE for the object persistence?

    20. Re:Toolsets by Anonymous Coward · · Score: 0

      Yeah, until some weird text conversion issue farks your whitespace.

    21. Re:Toolsets by ednopantz · · Score: 1

      Someone explain to me why dynamic typing is a good thing. I usually think dynamic typing means insidious bugs that are really hard to hunt down. I was quite suprised to see dynamic typing when I first checked out Python.

    22. Re:Toolsets by Tellalian · · Score: 1

      Somehow, I have a feeling that optional variable declaration will be a poor substitute for required variable declaration. Of course, there's nothing stopping you from "optionally" declaring your variables at the top of your code (e.g. myvar=0). What the parent wants is a throwback feature from static languages like C, which most people use Python to avoid. Python also supports the semicolon, so the homesick C programmer can write almost all their Python code on a single line if they wish, but this largely defeats the purpose of using a language as elegant as Python. IMO, we already have too many concesssions to obtuse parent languages already. Let's have Python stand on its own feet, and stop implementing features that have no practical value.

    23. Re:Toolsets by shutdown+-p+now · · Score: 1

      If the code looks fine, than it should be easily fixed by simply converting all tabs in it to spaces.

    24. Re:Toolsets by jrumney · · Score: 1
      Tried it? It works perfect for me. Using indentation you can actually see the structure of your code. If it looks good, it is good. No need to hunt down that missing bracket.

      I've never tried Python, but I've written enough makefiles to know that giving any significance to whitespace is a bad idea. For the last 10 years, I've used an editor with syntax highlighting and automatic indentation, so the missing brackets show themselves quickly.

    25. Re:Toolsets by dustman · · Score: 1

      the whole point is that in my editor, with my 4 space tabs, code will look fine with a mixture of hard tabs and "soft" tabs... Then, in your editor, or in the python interpreter, which think of a tab as 8 spaces, things aren't so great anymore.

      Hard tabs should be a syntax error. That would fix everything nicely.

    26. Re:Toolsets by msaavedra · · Score: 1

      One very convenient thing dynamic typing allows is passing args to a function which refer to different types that use a compatible API. For instance, take the following simple python function:

      def cat(*args):
      lines = []
      [lines.extend(file_obj.readlines()) for file_obj in args]
      return lines

      This function works somewhat like the unix cat command. It takes an arbitrary number of arguments (that's what *args means in python. It doesn't have anything to do with pointers, a la C), and assumes they are file objects. It returns a single list containing all the lines read from all the files.

      However, in python, who says I have to restrict myself to just using file objects? I can use other types as well, most commonly a string that has been wrapped in a StringIO class instance, which emulates the file object API. However, I might also want to pass custom classes that implement the readlines() method. Maybe I want to use this function on data I'm reading from a socket. The sky's the limit. And I can pass a mixture of all these different data types as the args for a single function call, and get the results I want with no hassle at all. Sure, this is a trivial example, but the technique is extremely useful, and I do it all the time when programming in python.

      Doing this sort of thing in statically typed languages can be really painful. To be fair, in C#, it appears you can do something similar without jumping through too many hoops, but it looks like it also throws out most of the benefits of static typing in those situations. Someone more knowledeable than I would have to describe how you could accomplish such things in C++ or Java, or (god forbid) in plain C. I imagine the code would be much more complex and hard to read (and hence a magnet for bugs) in any statically typed language.

      As I acknowledged above, static typing does have some advantages in catching bugs at compile time. Several types of bugs come to mind, and these are not as much of a problem as some people have made them out to be:

      1. Passing incompatible types as args to a function: This would happen in my example function if I passed it an int, which has no readlines() method. Such a problem will only show up at runtime. However, these are triggered very easily, especially if you are using unit testing (which you should be anyway).

      2. Passing types as arguments which, by coincidence, have the same method names, but they behave very differently: This would happen if we passed a type that had the readlines() method, but that method did something different than what we were expecting. This can be very insidious, but I can't imagine it happening very much (I've never seen it happen). This can also be minimized by using good naming practices, which I imagine most python programmers, who typically love readable code, are already doing.

      3. Variable assignment using a mis-typed name: To borrow an example from another post in this thread:

      def test_func(my_variable):
      my_varaible = my_variable * 2
      return my_variable

      Because of the mistyped name, this will not give you the results you would expect, and this can be very hard to debug. However, this problem is a bit contrived, in my opinion. This will only show up in python when you re-bind a name to a different variable, and there is almost never a reason to do this. However, if you're paranoid about this happening, give your variables distinctive names, use an editor that supports name completion, and use this feature religiously. No more problem.

      Anyway, sorry for the long reply to a short post.

      --
      "Any fool can make a rule, and any fool will mind it."
      --Henry David Thoreau
    27. Re:Toolsets by shutdown+-p+now · · Score: 1
      As I said: if the code looks fine in your editor, then you can just convert tabs to spaces and be done with that.

      Oh, and by the way, if you use a mixture of 4-space tabs and spaces to indent Python, it will not work, period. Python interpreter always treats tabs as 8 spaces, so the first time you use 2 tabs to indent to (supposedly the same) level as the previous line with 8 spaces, it will complain.

      Hard tabs should be outlawed, true. YAML does that, and I believe they mentioned somewhere that one of Guido's personal regrets is that tabs were originally allowed in Python.

    28. Re:Toolsets by killjoe · · Score: 1

      I would add a couple of things to that list.

      1) Lack of a good container. Zope is OK but I would prefer something where I could have plain old files I could grep through and be able to package up applications and deploy them remotely a-la J2EE.

      2) Rock solid scheduling service.

      3) Some sort of a message service.

      4) Good scaliblity in the container including the ability to remote calls.

      5) All of the above bundled together as one install.

      Python needs an answer to J2EE. In fact whoever comes out with a good solid stack will win because both ruby and python are so much more fun and productive then java.

      Ruby has rails, it's missing a lot but it seems to have become the de-facto standard in the ruby world which will mean it will improve very rapidly. The python community doesn't seem to have decided on the one true application framework yet.

      --
      evil is as evil does
    29. Re:Toolsets by ednopantz · · Score: 1

      Thanks for the post. I see why it might be a good thing, but I still wouldn't do it.

      Working mostly in .Net I can see how I achieve the same results by implementing multiple overloaded versions of (basically) the same function.

      MyCatlikeFunction(String)
      MyCatlikeFunction(Str ing())
      MyCatlikeFunction(FileObject)
      MyCatlikeFu nction(ISomeMultiLineInterface)

      More work for the author, less for the caller.

      It strikes me that relying on callers to correctly test their code for incompatible types is asking for trouble. Expecting callers to know what a function can do (by Reading The FM) seems overly optimistic.

      But then again, the evil empire's ecosystem works not because we can read each other's source code but because we buy each other's dlls and expect them to expose trivially simple interfaces. If it don't say "I take strings too," it don't take strings.

    30. Re:Toolsets by VC · · Score: 1

      For a lot of people the default stack for python IS J2EE.
      Where i work we regularly run jython code under weblogic and ocassionally tomcat.
      Have a look at this excellent tutorial to see what i mean:
      http://seanmcgrath.blogspot.com/JythonWebAppTutori al.html

    31. Re:Toolsets by VC · · Score: 1

      Oops, clickable link here: Jython webapp tutorial

    32. Re:Toolsets by killjoe · · Score: 1

      Why isn't there a pure python equivalent. I happen to think that J2EE is overly complex and relies entirely too much on XML descriptors. In fact it's virtually impossible to develop J2EE applications without xdoclet.

      The ruby people have come up with a pretty clever thing in rails. It's new and need to mature but it's an innovation at least. It's remarkable they took advantage of the dynamic nature of ruby to make a framework.

      I am surprised that the vast and very smart python community never even bothered to do something like it.

      --
      evil is as evil does
    33. Re:Toolsets by Xrikcus · · Score: 1

      That's just it though, it doesn't look fine if the person wrote it using 8 space tabs, I now look at it using 4 space tabs. Fine if you know for sure they used 8 space tabs, but otherwise... Plus of course if two people did it, one using 4 space tabs and one using 8, now try doing a search and replace...

      I'm not sure I agree that hard tabs should be outlawed though. If everyone uses tabs for indentation then at least it's flexible in how the code can be viewed. I have gone back and forth between using spaces and tabs for indentation over time. The worst thing is coming across code that someone else has indented using 8 spaces for each depth and NOT used tabs.

      This only came up because I've just had to tell someone to fix the indentation of their code because it is unreadable in my editor with 4 space tabs (having the advantage of warning me that tabs and spaces are mixed, at least).

    34. Re:Toolsets by sjames · · Score: 1

      Hard tabs should be a syntax error. That would fix everything nicely.

      IMHO, indent spaces should be the syntax error! That way, 1 TAB = 1 level and each person can configure their favorite editor to the visual presentation of TAB that works best for them. Using space instead to enforce your personal presentation is rude.

      I would like to see source editors' understanding of TAB fixed up a bit though. Simple stops are OK in many situations, but when you try to have a neatly aligned definition of a struct or other group of variables, it falls a little flat.

    35. Re:Toolsets by Shadowlore · · Score: 1

      We're using SQLObject, which is in version 0.6, as an object-relational-mapper. It's got some limitations and is admittedly not 'enterprise ready'. it's hard to compare to the Perl DBI because the dbi just is an interface and doesn't do mapping.

      This is a case of comparing two entirely different things. The PERL DBI is for accessing databses (DataBase Interface). SQLObject is an ORM: an Object-Relational-Mapper.

      For comparison to PERL DBI you should use Python DB-API: DataBase API. http://www.python.org/peps/pep-0249.html

      a database API and an ORM are entirely different animals. To compare one langauges DB-API to another's ORM is well ... not worthy. Nor is it demonstrative of a "lack of mature toolsets". With your 14 years of programming, I'd have thought you knew the difference between an ORM and an API. ;)

      For example, GUI programming toolsets are more mature in Python than in Perl. The scientific toolsets likewise. I've found SQL-DB access via the Python DB-API to be far easier and more "mature" than Perl's.

      Regarding CPAN. Well, Python includes in the std. library much of the things in CPAN. In environments where the management is adverse to "third party" libraries and modules, this is a big win for Python.XML-RPC, SMTP, HTTP, NNTP, IMAP, POP3? They're all in there. Decent, usable, easy-to-configure command line parsing? It's in there. CSV file parsing, object persistence, network libraries, logging, sets, DBM, compressed file support, telnet, ftplib, cgilib, html libraries, xml libraries, cookies, queues, and memory mapped file support, generators? Yup, all in there.

      Much/most of those you have to CPAN out to get in Perl last I knew. When you have a million ways to do the same thing, something like CPAN is indeed a lifesaver. If you can find out what the submitters called the solution to your problem. When there isn't a million and one ways to do a thing, and your standard library is much more inclusive, it is less important to have a CPAN like tool.

      That said, there is PyPI ( http://www.python.org/pypi) and the Vaults of Parnassus (http://www.vex.net/parnassus).

      --
      My Suburban burns less gasoline than your Prius.
  12. Eh? by Donald+Ferrone · · Score: 0

    Sorry guys; April Fools' was two days ago.

    --
    Donald Ferrone, Ph.D
    Professor of computer science
    http://www.geocities.com/donald_ferrone/
  13. Captins log by GtKincaid · · Score: 0, Offtopic

    Star date 3042005 , we have recently encounter a strange spacial disturbance , The computers logs seem alterd and for some odd reason the Starfleet logo on the lcars monitors is replaced by a cartoon snake . Voice commands have been replaced with typing #! /usr/bin/env python

  14. sigh... how about a real opinion? by paRcat · · Score: 4, Insightful

    The first dozen replies are all trolls, so I'll add my experiences for posterity's sake.

    I've been using python for pretty much anything in my company that isn't web based, and things couldn't be better. There's talk about python being slower, which it is, but most libraries that do important things are just C wrappers anyway, so the speed decrease is negligible as python is just holding the logic. Tk is nice enough, I guess, but I tend to use wxPython. Either way, it gives you cross platform GUIs, which is always a nice thing. Using pyexe allows you to even 'compile' scripts into exe files with win32 machines.

    To be absolutely honest though, I can't think of an easier language to learn (I even teach >40 yo women now and then!) or a quicker language to code in. Once you're accustomed to it, the code just flows out, and I've seldom been disappointed by the results. The formatting requirement helps to ensure that your code isn't a disgusting mess that no one can figure out, YMMV.

    1. Re:sigh... how about a real opinion? by animaal · · Score: 1
      To be absolutely honest though, I can't think of an easier language to learn (I even teach >40 yo women now and then!) or a quicker language to code in.


      If this is the measure of an enterprise technology, I can't wait for the first release of "Logo Enterprise Edition"
    2. Re:sigh... how about a real opinion? by Anonymous Coward · · Score: 0

      I can't think of an easier language to learn (I even teach >40 yo women now and then!) or a quicker language to code in. Once you're accustomed to it, the code just flows out

      I suspect that you don't know Perl.

      As another post on this topic stated so elequently:

      "Yes python falls in this weird crack between a scripting language and a high performance programming language. combines the slowness of perl with the inconvnience of structured programming. Its too structured and takes too many steps to be a good scritping language and too slow to be a programming language."

      That is absolutely spot on. Try doing regular expressions in Python... ugh, it's like using a C library for regular expressions.

    3. Re:sigh... how about a real opinion? by Lord+Agni · · Score: 1

      I can't think of an easier language to learn (I even teach >40 yo women now and then!) or a quicker language to code in. Once you're accustomed to it, the code just flows out

      I suspect that you don't know Perl.

      And how long would it take to learn Perl? Do you think say, 3 weeks of learning/working with Perl would get you as much coding productivity as 3 weeks of learning/working with Python? I think not. As for doing regular expressions with Python v. Perl: regex's are brain-twisters no matter what you're using, Perl, Python, sed, even awk. And Perl borrows from BASIC (!), where a leading symbol tells you what kind of variable it is! Ever make the $var @var _var %var ~var error? (and I know some of them are not really Perl, but you get my point)

    4. Re:sigh... how about a real opinion? by Anonymous Coward · · Score: 0

      Do you think say, 3 weeks of learning/working with Perl would get you as much coding productivity as 3 weeks of learning/working with Python?

      Absolutely.

      I think not.

      Do you know Perl?

      As for doing regular expressions with Python v. Perl: regex's are brain-twisters no matter what you're using, Perl, Python, sed, even awk.

      I was not talking about regular expressions themselves. I was talking about using regular expressions. It's a pain in the ass in Python. Way too many people miss out on the power of regular expressions because their language makes it too hard to use.

      And Perl borrows from BASIC (!), where a leading symbol tells you what kind of variable it is! Ever make the $var @var _var %var ~var error?

      That is not a bad thing. See Ruby for a Perl-like system that kills Python.

  15. annoying languages by Anonymous Coward · · Score: 0, Troll

    no matter what cool features it has nothing is going to make me want to code in a language where you have to bung the self reference into the signature of class methods.

    php is annoying enough with $this-> accesses to everything

    can't somebody spend a bit more time on the basics?

  16. Economics by Anonymous Coward · · Score: 1, Insightful

    Python has a reputation for being quick to program in. If you just speak basic python, you can program the same stuff you could in qbasic. It is very comparable to Visual Basic at that level. I find it very good for quick-and-dirty stuff.

    The difference from the simpler languages is that it can do very difficult things. Once you get used to some of its unique features (I remember how thrilled I was to discover dictionaries) you can put serious applications together a lot faster than with other languages.

    The bottom line is that you can do serious applications a lot faster than you can with other languages. In a business environment, that translates to profit.

    p.s. "Integrated development environments (IDEs) are also more numerous than polished." Yep, I use emacs.

  17. Support by FidelCatsro · · Score: 1

    Marketing and support , Python is in dire need of some big name support , This is one of the primary reason Java became such a large player in the enterprise market .

    --
    The only things certain in war are Propaganda and Death. You can never be sure which is which though
  18. Please enlighten me by bogaboga · · Score: 1

    I know that Java is used to push realtime market/financial data to a possible countless number of hosts. One only has to visit http://www.refcofx.com/FinanceChart.html?symbol=EU R/USD to see java in action, (assuming the java runtime is installed). Can one use Python to do the same? Where would it play its role? The backend or on client machines?

    1. Re:Please enlighten me by srid · · Score: 1

      One only has to visit http://www.refcofx.com/FinanceChart.html?symbol=EU R/USD to see java in action, (assuming the java runtime is installed). Can one use Python to do the same? Jython

      --
      - srid
    2. Re:Please enlighten me by srid · · Score: 1

      One only has to visit http://www.refcofx.com/FinanceChart.html?symbol=EU R/USD to see java in action, (assuming the java runtime is installed). Can one use Python to do the same? Where would it play its role? The backend or on client machines?

      Jython

      --
      - srid
    3. Re:Please enlighten me by Sweetshark · · Score: 1

      Can one use Python to do the same?
      Not as a applet.
      Where would it play its role? The backend or on client machines?
      A little interface script on the server connecting to a database (like PHP does now most of the time.) Or to previde a complete CMS. On the clientside either XUL in Mozilla is still a Toolkit to be discovered or a browserindependant Python-client (Python is well integrated with native Toolkits, for example via wxWindows - used in bittorrent).

    4. Re:Please enlighten me by sql_noob · · Score: 1

      For client side it's better to use java, the java is already installed for most system. It is also standard and work fine on all systems.
      In Python, it can use mod_python+rrd for server side, the result is a simple chart. Or just provide the data on the server side and run a python program on client side (python+wxWidgets/pygtk), py2exe is recommended to avoid dependence problems.
      Python is better for simple things, simple solutions. In the company that I work, there are no IT departments. So I use python programming to increase productivity.

  19. Re:Hey timothy by Anonymous Coward · · Score: 0

    Yes.

  20. A quick check on Dice.com by thammoud · · Score: 3, Interesting

    for Python jobs. It returned 312 jobs. Java returned 9196. I don't think Python will ever dent Java's dominance in the enterprise. Do you really expect Python to do what .NET has failed to do? Not a chance. It is a cute scripting language. No more and no less. Python competes with Perl and Ruby.

    1. Re:A quick check on Dice.com by jimicus · · Score: 5, Insightful

      Had you done the same test 8 years ago but searched for Java versus C/C++, you'd probably have seen the exact same results.

    2. Re:A quick check on Dice.com by FidelCatsro · · Score: 2, Interesting

      Alot of us never thought PHP could make a Dent in perl , but it did.
      if you had checked for python jobs just 2 years ago i would be amazed if you could find any .312 is a dent although a small one , and yes i do expect it to do what .Net has failed to do this as .NET has no real advantages over Java in the enterprise market , and the dependance on MS OSs is a real disadvantage in a market where Solaris etc still play a sizable part
      (mono is not an option right now).
      Python is able to run on all of these systems , Python has been proven over the years as a strong language and most importantly Python has the support of the OSS world which is becoming an increasingly large force in the industry .
      So maybe right now python cant take over , but 5-10 years down the line you may just see a very difrent picture

      --
      The only things certain in war are Propaganda and Death. You can never be sure which is which though
    3. Re:A quick check on Dice.com by thammoud · · Score: 1

      The role of Java vs. C/C++ is clearly defined. Provide a fairly portable platform that eases business application development. I just do not see what Python gives me above Java. I don't need some trivial examples of syntatic sugar that Python has. Give me a real business reason that will cause enterprise developers to abandon Java and move to Python.

      There simply isn't a a business application development platform that has more industry and development muscle behind it. Microsoft and all its money has not dented Java's dominance in the enterprise. Just Check C# or .NET vs Java on Dice. Pretty sad given the billions that MS has spent.

    4. Re:A quick check on Dice.com by thammoud · · Score: 1

      If opensource was a measuring stick for a language success, then Java would have failed miserably. Java also runs on all these systems. Why should I abandon Java for Python?

    5. Re:A quick check on Dice.com by FidelCatsro · · Score: 1

      If you like java then you shouldnt , however if you prefer python you should use that .
      This is not about converting everyone to python , its about having another tool in the shed .Another Choice for the developers .Javas dominance in the market is because it is a good language , however it is not perfect for everything .
      Python gives us this open option , and it already has many years of experiance behind it .So fair enough do not use it , but this is not about converting everyone , only some who see the advantage

      --
      The only things certain in war are Propaganda and Death. You can never be sure which is which though
    6. Re:A quick check on Dice.com by Edward+Faulkner · · Score: 1

      It is a cute scripting language. No more and no less.

      The idea of a "scripting language" is a holdover from the bad old days when you had to choose between a painfully low level system language and a painfully slow but powerful language.

      Today hardware is fast enough that you can do away with the low level languages entirely, for the vast majority of applications.

      A language is a way of thinking, and most people are not willing to change their way of thinking once they're comfortable. Dynamic typing, for example, fills the typical C++ or Java programmer with fear. But in practice it provides far more benefit than cost. If you don't believe me, you'll just have to try it. I can't prove it to someone who's use to thinking in Java.

      Also, check this out:

      http://www.paulgraham.com/pypar.html

      --
      "The danger is not that a particular class is unfit to govern. Every class is unfit to govern." - Lord Acton
    7. Re:A quick check on Dice.com by Anonymous Coward · · Score: 0

      It is a cute scripting language. No more and no less.

      You'll come around :-)

    8. Re:A quick check on Dice.com by arevos · · Score: 1

      Assume for a moment that programmers can code more effectively in Python than in Java. Then those companies that use Python over Java will have an advantage. If a company dismisses Python as just 'a cute scripting language', then they might find themselves losing out to their competitors that do use Python.

      So I don't think it's inconceivable that Python might replace Java eventually, at least in the more successful companies. It's also early days for .NET too. I wouldn't rule out Microsoft just yet.

      Perhaps I'm a little naive, but I do believe that eventually programming practises will improve. I'm sure they can't get much worse! :)

    9. Re:A quick check on Dice.com by horza · · Score: 1

      Did you actually look at the list of those offering python jobs? Google, Lockheed Martin, Sun, Akamai, IBM and many other well respected companies. Python is only starting to ramp up slightly, and it will take a while longer whilst the libraries become more mature and extensive, but I personally think it's going to take a large chunk of the market away from both Java and PHP.

      Phillip.

    10. Re:A quick check on Dice.com by Bob9113 · · Score: 1

      I don't think Python will ever dent Java's dominance in the enterprise.

      I completely agree. Just as we could all tell (all the way back to 1999) that Java would never put a dent in Perl .cgi on the server side. It's just not designed as a server side scripting language the way Perl is. ;)

    11. Re:A quick check on Dice.com by Liquidrage · · Score: 1

      I had to debate whether to reply or mod you down. Considering I don't like modding down, I chose the later.

      .NET search at dice returned 7516 matches to Java's 9186.

      If that doesn't qualify as a *dent* to you, then you have issues that are not worth arguing over.
      Especially considering how new .NET is, that's a large dent. The kind of dent that in a few years could ever surpass Java in terms of enterprise development.

      Let's get one thing straight here. .Net does not .Suck.
      You may not like the source behind .NET, but there's no need for you to resort to fiction to try and make your point.

    12. Re:A quick check on Dice.com by Anonymous Coward · · Score: 0

      The new breed of 'scripting languages' do offer slightly higher productivity than Java for simple tasks.

      I still prefer Java to Ruby for heavy-duty enterprise applications, though. (And haven't touched Python at all since i discovered Ruby.)

    13. Re:A quick check on Dice.com by Liquidrage · · Score: 1

      I don't agree. And even if the search results were the same, Java was being heralded as a language that would change the face of programming. Python is not getting the same *buzz* Java had.

      I've been making a living writing software for the past 8 years now. Before that, I was smack-dab in IBM country, in an area about 30 miles North of NYC. If you're familiar with IBM locations you'll understand what I mean by IBM country.

      Working at a Software Etc. in a very large mall at the time, the IBMers would come in constantly buying/ordering Java books. And they would do so with zealotry. There was a major push for Java coming from one of the most influential companies (if not *the* most influential company for the time). I knew a lot of them as *regulars* and from the Computer shows in the area that all us geeks went to grab Simpsons Doom on floopy, RAM, etc.., and they were all telling me the same thing. Java is the future, Java is where it's at. Learn Java (They knew I was aspiring to be a programmer. Set low goals and you rarely fail, that's my moto).

      Is Python getting that same push? I mean, I think /. is influential in it's own right, but I don't see much about it outside of here and it's own little niche communities. Google is certainly influential in it's own way, but until they get into the business of solution provider/developer for custom business software I'm not going to give Google the same level of influence IBM had.

      And I certianly, without doubt, will say Python is not even close to having the *hype* that Java had in it's early days.

    14. Re:A quick check on Dice.com by Liquidrage · · Score: 2, Interesting

      See my other post to the same parent. How can you say it hasn't dented it?

      You can repeat the same ol' tired mantra, over and over, it doesn't make it true.

      .Net is getting heavy use in the enterprise, and in this thread, has about 80% of the jobs that Java has advertised. Now personally, I don't think that's the best possibly way to determine use. But it is what is used in this thread. .NET is about 3 years old, Java's about 10. That's a dent.

      And I'll even make the logical case showing how it is a *dent*, and not just a VB rollover (which I'm sure much of it is).

      Apps, that due to scope and criticality, would never have been done in VB (mostly due to it's lack of support for true OO design) are getting done in .NET now. For certain apps, there really was no competition for Java. Now there is. And it comes down to a few criteria for the managers (experience of the current staff if any, what marketing smoke was blown up their ass and by who, what buzzwords their boss is big on at the moment, and if there's anyone actually technical in the decision making process that actually is able to point out the best tool for the task at hand, amongst others).

      Also, it used to be split, you had MS goons writing ASP for web (with maybe some really crappy custom COM being a DAL, or some specialized functionality), VB for desktop. Now, it's all wrapped into one package, .NET

      And it is being heavily used in Enterprise development.

    15. Re:A quick check on Dice.com by labratuk · · Score: 1

      All you have managed to do there, my friend, is prove that java is more often than not used as a buzzword.

      --
      Malike Bamiyi wanted my assistance.
    16. Re:A quick check on Dice.com by Anonymous Coward · · Score: 0

      As has been pointed out before (e.g., "What Color Is Your Parachute?"), there is no such thing as "the job market". And online job postings count for only a small fraction of positions filled.

      The only conclusion you can draw from this is that Dice.com has more postings for Java jobs than Python jobs. This doesn't mean Java is more popular, or used by more businesses, or even that companies tend to hire more Java programmers.

      It's not a useful data point; it doesn't mean much at all.

  21. Yes, but what about the GUI - speed no problem by bblazer · · Score: 4, Insightful

    While I agree wholeheartedly that python is a wonderful language to code in, I think that it lacks a sting GUI system. Yes wxPython is cross-platform, but without getting overly detailed here, it definately lacks the detail and robustness of SWT or even Swing. Until wxPython can stand up to those, I think the movement to it for more broad based use with be a bit slow. As far as apeed goes, who cares? We are not programming for 286 machines anymore!

    --
    My .bashrc can beat up your .bashrc!
    1. Re:Yes, but what about the GUI - speed no problem by Anonymous Coward · · Score: 0

      As far as apeed goes, who cares? We are not programming for 286 machines anymore!

      Notice the headline. That word Enterprise isn't referring to the show.

      You're thinking in terms of desktop computing. Think in terms of massive distributed systems processing millions of requests. The larger the scale, the more apparent the piss-poor performance decisions, and the more expensive the hardware becomes to support such things.

      That's when you care.

    2. Re:Yes, but what about the GUI - speed no problem by sql_noob · · Score: 1

      Totally agree!

      I found that the python gui is a distraction. Neither wxpython nor pygtk really ready for production use.

      In this moment I dropped GUI and go for simple web programming using mod_python. It is OK for simple things, although debugging is even harder.

    3. Re:Yes, but what about the GUI - speed no problem by Klivian · · Score: 1

      >I think that it lacks a sting GUI system. You are clearly not knowing what you are talking about, Python has for years had a working and stable implementation of one of the best cross-platform GUI toolkits available. It is actually considered better than most, if not all existing noncross-platform toolkits too. So with factors like speed, robustness, portability and ease of use I don't think anything out there comes close to PyQt.

    4. Re:Yes, but what about the GUI - speed no problem by at_18 · · Score: 1

      I use PtQT, and it's pretty good. Can be a bitch to compile, though.

    5. Re:Yes, but what about the GUI - speed no problem by costas · · Score: 4, Insightful

      Agreed on wxPy, but you do know that SWT and Swing are scriptable from python thru Jython (or the Python-Java bridge project, forget the name right now)? IIRC there has also been an effort to wrap the native SWT widgets in python w/o going thru Java, which would be awesome.

      But overall, I completely agree: the std python distro needs to standardize on wx, get rid of Tk and at least incorporate the win32all distribution in the win32 version (it just too nice to leave out).

      My biggest peeve as a long-time pythonista (the newsbot in my sig is 25k+ LOC of pure Python) is the standard library: I can live w/o a CPAN-like repository (although that would rock), but for a language that used to boast that it comes "with batteries included" the std lib has gone downhill in the last few versions: too many overlapping or competing modules (why, why do we need httplib, httplib2 and urllib?? or getopt and optparse? and what are the differences between them?) and not enough attention into polishing the library into the fantastic toolkit that was around the 1.5 or early 2.1 series.

      Someone, probably the BDFL, needs to stand up and take obsolete modules *out* of the standard library, so that the better ones can be improved even more, instead of having various tweaks and improvements going into overlapping modules. That's the point of having a *standard* library after all...

      I'd rather have a good std lib than function decorators and other exotic language constructs...

    6. Re:Yes, but what about the GUI - speed no problem by ArmyOfFun · · Score: 1

      I agree about the overlapping modules things. Another one a co-worker pointed out to me a couple weeks ago is os.name and sys.platform (both of which return different strings).

    7. Re:Yes, but what about the GUI - speed no problem by qbwiz · · Score: 2, Insightful

      I wouldn't recommend taking modules out of the standard library, but merely marking them as deprecated and possibly removing their documentation from the new versions of python. That way, we won't break old programs, but we could prevent people from starting to use them.

      --
      Ewige Blumenkraft.
    8. Re:Yes, but what about the GUI - speed no problem by shutdown+-p+now · · Score: 1
      The other problem is that wxPython looks and feels very un-Pythonic. I mean, message maps in a dynamic language? c'mon...

      What is really needed is a good cross-platform UI toolkit written in Python and conforming to the Python philosophy. So far there is none.

    9. Re:Yes, but what about the GUI - speed no problem by Dominic_Mazzoni · · Score: 1

      While I agree wholeheartedly that python is a wonderful language to code in, I think that it lacks a sting GUI system. Yes wxPython is cross-platform, but without getting overly detailed here, it definately lacks the detail and robustness of SWT or even Swing. Until wxPython can stand up to those, I think the movement to it for more broad based use with be a bit slow. As far as apeed goes, who cares? We are not programming for 286 machines anymore!

      I disagree. I think that wxPython produces far better GUIs than swing, because they're native GUIs. As a result, they're far more responsive, and they're guaranteed to look and feel right. You may think that users don't care, but they do care - they get very confused trying to use Swing GUIs, especially when menus, scroll bars, combo boxes, and such don't act exactly like they do on their native platform.

      wxPython is arguably a little bit harder to learn at first. But ultimately I think it's a far more powerful tool.

    10. Re:Yes, but what about the GUI - speed no problem by Ian+Bicking · · Score: 1
      I think the standard library is challenging because it's representative of a younger Python, when backward compatibility wasn't a liability (since there was no backward) and the community of developers was small. As it grew older, there's been several cases where people have ported Java libraries as part of the standard library (unittest, logging), and the result hasn't been very good. Not to pick on those programmers who made those modules, but it has made the Python community a little shy about adding new modules unless they are really stable and have proven their utility and pleasantness of interface. So now the standard library is growing slowly; maybe with some language changes this could be resolved, but it's just a hard problem.

      I wrote more about the standard library sometime back on my blog.

    11. Re:Yes, but what about the GUI - speed no problem by Anonymous Coward · · Score: 0

      Use pyGTK instead, very robust and cross platform.

  22. Google is not enteprise? by vidarlo · · Score: 2, Interesting

    It seems Google is using Python for a good deal of stuff... And I thought google was enteprise

  23. Embrace and Extend by The+Amazing+Fish+Boy · · Score: 1

    Happy. It's open, and could be a sign that MS is actually "getting it".

    I wonder if anyone said that when they introduced IE.

  24. Python *is* painful by photon317 · · Score: 0, Flamebait

    Who in the 90's writes a language where whitespace has meaning???

    --
    11*43+456^2
    1. Re:Python *is* painful by wookyhoo · · Score: 1

      How about these people?

      ILM, Rackspace, United Space Alliance to name a few.

    2. Re:Python *is* painful by krumms · · Score: 1

      Who in the 90's writes a language where whitespace has meaning???

      Somebody who realises the importance of the semantic structure of program source code.

    3. Re:Python *is* painful by justanyone · · Score: 4, Insightful
      Curly braces { } have always been a stylistic thorn in the side of C, C++, and now Java programmers. I'm sure other languages use them, too.

      The old K&R style of doing:
      if (test) {
      expression;
      }
      versus:
      if (test)
      {
      expression;
      }
      this is NASTY in the debates it causes and wars people fight over which is 'right' or 'easier'. For those who don't know, Python doesn't use braces, it uses any consistent indent, as in:
      if (test)
      expression
      Very simple. Reduces line count by 1 or 2 and completely removes the religious debate about brace location. I really like this. There's enough problems debating what the code header/copyright/IDENTIFICATION DIVISION (grin) section's going to look like. "I like #####!" "No, I like #-------!!!", "You Suck!" "No, You Suck!" etc.

      Don't knock the lack of braces until you try it. it really does make the code look cleaner.

      --Kevin
    4. Re:Python *is* painful by Fragmented_Datagram · · Score: 2, Informative

      Well, these guys do...

      Whitespace

    5. Re:Python *is* painful by sp3tt · · Score: 0

      Indentation, not whitespace.
      It is there to make code easy to read. Not just one mess of calls. You can't obfuscate Python very much, and that is good.
      And who the fuck programs in an environment that does not support preserving of indentation?

    6. Re:Python *is* painful by beliavsky · · Score: 1

      I prefer Python's indentation to the curly braces of C/C++/Java, but my favorite is to have a keyword end the block, as in Fortran or Visual Basic, for example

      if (test) then
      something
      endif

      Without semicolons and braces littering the code, I think Fortran 90 and later versions have a cleaner syntax than the curly brace languages.

    7. Re:Python *is* painful by Guido+von+Guido · · Score: 1
      I gotta admit that this kept me from trying python for some time. However, I tried it for a mall project a few months ago, and I barely noticed the whitespace thing at all.

      I like ruby better and I'm more comfortable in perl, but python is still a neat language.

    8. Re:Python *is* painful by Rick+and+Roll · · Score: 1
      My problem with your style is that you use only two spaces for indentation.

      I hope you follow the "tabs for indentation, spaces for lining up" design. That's what I do, and I set my tabs to be 5 characters wide.

      If you were using Prothon (anagram for HotPorn), you would be mandated to do it.

    9. Re:Python *is* painful by pexatus · · Score: 1
      Reduces line count by 1 or 2 and completely removes the religious debate about brace location.

      In Java, the brace (or any other formatting) debate should be over, since Eclipse lets you auto-format the code however you like with one keystroke. It's amazing how quickly I can douse the fire of one of these arguments by demonstrating something as simple as Ctrl + Shift + F.

      Of course, this is ineffective on the crowd that believes "real men don't use IDE's", and who choose their formatting not for ease-of-reading, but for ease-of-typing.
    10. Re:Python *is* painful by Anonymous Coward · · Score: 0

      Python doesn't use braces, it uses any consistent indent

      ... and I thought using white space for programming structure went out the door w/ Cobol. Try working w/ code from several programmers, some who use two spaces, some who use one tab, some who use two tabs... it totally sucks. I realize, you have the same problem in any language, but most other languages won't actually use the tabs/spaces as scructure.

    11. Re:Python *is* painful by rbarreira · · Score: 4, Insightful

      If I read another comment talking about the fucking lack of braces I'm going to punch the monitor... Why are people giving that so much weight instead of discussing the features of the languages instead?

      And who cares about the programmers discussing brace placing styles? They'll surely find other things to discuss about with Python...

      --

      The AACS key is NOT 0xF606EEFD628B1CA427BEA93A9CA9773F
    12. Re:Python *is* painful by tom's+a-cold · · Score: 1
      and I barely noticed the whitespace thing at all.
      Likewise. I've used Python on and off for about six years now, and have written LOTS of code in it. I also do quite a bit of prototyping in Zope. The whitespace issue is largely a red herring. I personally think it helps maintainability a little, but much of the debate about it is just disproportionate.

      Used in its proper context, Python is just wonderful. The performance issues everyone keeps posting about are seldom observed in the wild. I'd like one of the posters who talks about how slow Python is to cite a real-life example of a Python implementation that they have used that has response-time problems that are caused by Python. I wouldn't make it my first choice for implementing a kernel scheduler, but there's very little coding in most IT shops that is speed-critical.

      Anyway, most of what I've read in these posts is nothing but rules of thumb remembered, but not fully understood, from CompSci lectures. But here's the more important principle. If you're optimizing, you need to look at the impact on the whole development lifecycle, not just at code execution. You also need to consider how much complexity a good programming team can effectively manage, and consider the impact on maintainability of various arcane tweaks, keeping in mind the fact that the literature abounds with evidence that programmers are quite bad at knowing in advance which parts of their code to optimize.

      And in my experience, when you do have to optimize, there's more payoff in fixing the algorithm than there is in low-level tuning.

      By the way, little things sometimes annoy me too. While there's a lot to appreciate in Ruby (love them continuations), the "@" prefix on instance variables really gets up my nose. But I don't let my irrational response get in the way of choosing an appropriate language for a particular problem set.

      --
      Get your teeth into a small slice: the cake of liberty
    13. Re:Python *is* painful by Anonymous Coward · · Score: 0

      I have a certain love for violence so I think I should remind you that Python does not use curly braces and Python is clearly better because of it.

    14. Re:Python *is* painful by davegaramond · · Score: 1

      It's too bad that a single character has prevented you to explore a nice language more. I guess some people are more convenient in writing: self.foo = 1 self.bar = 1 self.baz = 1 than: @foo = 1 @bar = 1 @baz = 1 which wonders me to no end :-)

    15. Re:Python *is* painful by tom's+a-cold · · Score: 1

      Naw, I've used Ruby. My whining about the "@" is just a nit. My main reason for not having adopted Ruby is my pre-existing knowledge of Python. I haven't yet run across a project where Ruby gives me a big advantage over Python. Since Ruby has a few nicer features, I'm sure that I'll eventually find a project where Ruby gains me something. But the projects I've done lately have been in the zone where the two languages are equally useful, so I've stuck to the devil I know.

      --
      Get your teeth into a small slice: the cake of liberty
  25. If Python sucks so bad... by Zontar+The+Mindless · · Score: 1

    ...then why is it found in nearly every Linux distribution? ...and why is there ActivePython? BTW, I've used this with "classic ASP" and, not unlike JScript, it makes it almost a tolerable environment to use it in.

    List comprehensions rule.

    --
    Il n'y a pas de Planet B.
    1. Re:If Python sucks so bad... by Anonymous Coward · · Score: 0

      If Python sucks so bad...

      ...then why is it found in nearly every Linux distribution?

      Because Linux distributions are like garbage cans and there's nothing they won't put in them.

      And unfortunately, because of the rediculous web of dependencies that get built from this behavior, it's nearly impossible to clean them up and slim them down. Just try loading a non-graphics (no X) install sometime with most distributions without still having to have a pile of graphics libraries loaded because a billion utilities are linked against them even though you only want to use their command-line mode.

      On the other hand, try loading FreeBSD sometime and load just the "bin" distribution. Talk about a clean slate that you can build something on.

    2. Re:If Python sucks so bad... by Zontar+The+Mindless · · Score: 1

      You like BSD.

      You don't like Linux.

      And what has this to do with Python, exactly?

      --
      Il n'y a pas de Planet B.
    3. Re:If Python sucks so bad... by GnuVince · · Score: 1

      If Windows is so bad, why is it included in every PC? Sorry, I like Python, but this kind of argument just isn't good, you come off as a troll. You said that list comprehensions rule, why didn't you give examples of them against what you need to do in Java or work on collections? That would've been a better point.

    4. Re:If Python sucks so bad... by Zontar+The+Mindless · · Score: 1

      World of difference. Python is *offered* as part of most Linux distros and you do have a a pretty clear choice (not) to install it; it's not rammed down your throat with a hefty price tag attached as Windows tends to be.

      (And I don't have to post code every time I want to voice an opinion about something. If you agree with it, then why are you trying to tear me down, eh?)

      --
      Il n'y a pas de Planet B.
    5. Re:If Python sucks so bad... by Anonymous Coward · · Score: 0

      You idiot, EVERYTHING is offered as part of most linux distributions - crap or not. That's the delights of free software. Had a look at the Portage tree in Gentoo lately? Or the contents of the Fedora Core CDs? You really think all of that is included because it's smashingly high-quality, or because they can?

    6. Re:If Python sucks so bad... by Zontar+The+Mindless · · Score: 1

      Smalltalk, which I happen to think is a pretty cool language, is not included with most Linux distros. So no, "everything" is not necessarily so offered.

      --
      Il n'y a pas de Planet B.
  26. Less Time Coding, More Time Debugging/Maintaining by BarryNorton · · Score: 1

    Not that I think Java is the ideal example of a modern programming language (far from it), but this trend towards 'lean' scripting languages where almost every bit of rubbish you can write is executable, and every bit of code you look back at (even your own code two days later) looks like rubbish is really troubling.

    Is it just because there are more and more people writing code who've never had to work on maintaing large-scale software?

  27. No dice by Anonymous Coward · · Score: 0

    had you used something other than a 6sided die your results would be different.

    Besides Python is evil, why would i use that which poisoned eden.

  28. Three barriers to enterprise Python by blackhedd · · Score: 5, Insightful

    1) The twenty minute problem
    Many programmers, including top ones like Eric Raymond http://www.linuxjournal.com/article/3882, are so put off by Python's use of whitespace as a block delimiter that they swear never to touch the language. In my case, this lasted for two years. You need to spend twenty minutes learning the language, after which the whitespace stops being a problem and starts looking like one of the many great ideas in the language. The challenge is getting people past their initial disgust enough to try it.
    2) Misperceptions about typing
    Many people think agile languages like Python and Ruby are not strongly typed and therefore present scalability problems and can't be used reliably by large teams. But Python and Ruby are strongly typed (unlike Perl)- you don't get type conversions you don't ask for. The real distinction is that the agile languages are dynamically typed rather than statically typed like Java/C++. To truly grasp the notions of "duck-typing" and lazy evaluation of types is as much a stretch as it was to "get" objects for those of us who were around 15 years ago- it's a basic change in how you think. You'll know when you're there, because you'll see in a flash that Java's static type declarations are not only redundant and painful, but they are also in themselves a key source of brittleness in large programs over time.
    3) The youngsters' problem
    This is probably the biggest barrier: university CS departments have become nothing but Java training courses. In trying to better prepare grads for actual careers, they have added a lot of basic business teaching, which is good. But they no longer bother to give students a real understanding of actual computer science, sticking instead to a cookbook approach using Java. So young people arrive in enterprise IT shops knowing nothing but Java and thinking they know everything, so they are not open to anything requiring a different intellectual approach.

    1. Re:Three barriers to enterprise Python by MemoryDragon · · Score: 1

      The main problem is not the whitespace identation itself, it is more that python like make barks on mixed intendations (aka, once uses tabs the other blanks) which can become a serious problem once you are more than a lone programmer on a project. And as we all know, the lone programmer is a myth. The other stuff like non declarative variables is a problem which many languages share but not having it in python can be a serious problem for bigger projects. At least there is pychecker.

    2. Re:Three barriers to enterprise Python by blackhedd · · Score: 1

      Your point about whitespace is well-taken and interesting, but the thrust of the original post was "Python in the Enterprise." And here the problem is just prejudice, not any specific technical issue. I have talked to so many otherwise bright and open-minded people who just won't touch Python because of how it uses whitespace (as I said, I was one of them!)
      In regard to "nondeclarative variables": these are a feature in Python, not a "problem." This may strike you as fanciful, but no amount of automated tools like pychecker and the Java compiler will help you to actually understand and communicate how a program is supposed to work. But it's just as fanciful to suppose that static typing and interface "contracts" promote understanding across large teams! This is the core objection that the more perceptive people have against Python and Ruby, but it will be disproved over time.

    3. Re:Three barriers to enterprise Python by Anonymous Coward · · Score: 0

      I would not exactly call ESR a top programmer. Maybe I high-profile one but that is even misleading. ESR is more known for his prose than his code.

    4. Re:Three barriers to enterprise Python by blackhedd · · Score: 1

      Is that you, Eric? ;-)

    5. Re:Three barriers to enterprise Python by michael00_98 · · Score: 1

      Did you even read the article you linked to? ESR LOVES Python.

    6. Re:Three barriers to enterprise Python by blackhedd · · Score: 1

      ESR LOVES Python: That's why I quoted the article.
      Eric initially avoided Python because of whitespace. After twenty minutes of practice he realized it was a good thing rather than a bad thing. I'm saying that the same would be true for a lot of other people, if only they would put in the twenty minutes.

    7. Re:Three barriers to enterprise Python by Bob9113 · · Score: 2, Insightful

      2) Misperceptions about typing
      Many people think agile languages like Python and Ruby are not strongly typed and therefore present scalability problems and can't be used reliably by large teams. But Python and Ruby are strongly typed (unlike Perl)- you don't get type conversions you don't ask for. The real distinction is that the agile languages are dynamically typed rather than statically typed like Java/C++. To truly grasp the notions of "duck-typing" and lazy evaluation of types is as much a stretch as it was to "get" objects for those of us who were around 15 years ago- it's a basic change in how you think. You'll know when you're there, because you'll see in a flash that Java's static type declarations are not only redundant and painful, but they are also in themselves a key source of brittleness in large programs over time.


      The "unwanted type conversions" thing is a nice straw man, but it won't wash. The value of strictly typed languages is in compile time type checking. It's good to have languages that are not type checked, and it's good to have languages that are. The former is better with smaller groups, smaller programs, or more proficient developers. The latter is better with larger groups working on larger programs with more apprentices on the team. The former allows more flexibility and speed. The latter offers more imposed speed limits (and less car crashes).

    8. Re:Three barriers to enterprise Python by Anonymous Coward · · Score: 0

      >> The real distinction is that the agile languages are dynamically typed rather than statically typed like Java/C++.

      Very bad, it really increases developing times since an error which could simply be signalled at compiling time is, instead, found only when executing the wrong line.

    9. Re:Three barriers to enterprise Python by dynamol · · Score: 0

      "And as we all know, the lone programmer is a myth." Ah I have finally become a myth. Seriously tho you are tottaly right. Python is cool , but it will take much improvment and time before it will competer with Java/C++.

    10. Re:Three barriers to enterprise Python by frogg320 · · Score: 0

      I had a class that used VPython for a project...but that was an upper level physics course. Hopefully it will begin to take over in the science world, because we're still running FORTRAN. Not kidding. (It's a tried and true language, which is hard to come by in science)

    11. Re:Three barriers to enterprise Python by Peter+La+Casse · · Score: 2, Informative
      The value of strictly typed languages is in compile time type checking. It's good to have languages that are not type checked, and it's good to have languages that are.

      You appear to be confusing static vs dynamic type checking with strong vs weak type checking.

      Static type checking occurs at compile time, whether or not the language is strongly or weakly typed. Dynamic type checking occurs at run time, regardless of whether or not the language is strongly or weakly typed.

      Disagreement still exists about what constitutes strong vs weak typing; the extreme definition of strong typing is "type checking that prevents all type errors", while the corresponding definition of weak typing is "type checking that does not prevent all type errors". I call this an extreme definition because it makes strong typing so rare that the term becomes less useful.

      I think that the terms strong vs weak typing are best used when comparing two languages, so you'd say e.g. "compared to C, Python has strong typing". This contrasts with static vs dynamic typing, which don't need comparison to be valid: C is statically typed, regardless of what the status of Python is.

    12. Re:Three barriers to enterprise Python by shutdown+-p+now · · Score: 1
      You need to spend twenty minutes learning the language, after which the whitespace stops being a problem and starts looking like one of the many great ideas in the language.
      ... and you need to spend one more year coding in the language to understand how awful that particular idea is. Ok, here I am, in the middle of the function which spans several screens (not my code!), on a line which is indented by 5 levels. The next one is indented by 2. So, um... what just ended? Highlight braces? - oops, nothing to highlight. And don't even get me started on the whole 'tabs or spaces for indentation' thing.
    13. Re:Three barriers to enterprise Python by MemoryDragon · · Score: 1

      it is less the static typchecking which is a non issue in most enterprise apps (I do that stuff) it is more the non declarative nature which can become a problem once the code grows bigger. I will give you an example.
      myvar = 1 ... some code here myval = myvar + 1 ... ops a typo above should be myvar ... ad some code here
      a typical issue which could have been caught at compile time/check time if there was need for a declaration of myvar first forced. Shure you can write a unit test, but face it the harsh reality is, you dont do that for every method you write and lets see it that way some kind of
      var myvar, othervar, thirdvar

      is less talkative than an entire unit test

      The next problem really is the whitespace problem, once you work in teams of more than a handful of people now matter how strict the coding standards are, you will run automatically into the problem. And having the checker, compiler, runtime barking on an obscure invisible char and having you hunt down that on a regular base, is not something I would call more productive.
      Ruby solved that issue elegantly, they simple leave it up to you how to do blocks, explicit blocks definitely dont bark on any whitespaces. Not knowing Ruby explicitely enough, I think I have in mind that you still have the whitespace option if you want to.

    14. Re:Three barriers to enterprise Python by MemoryDragon · · Score: 1

      Wow a living legend, no seriously, most projects I worked on after university were projects with at least 3-4 people in it.

    15. Re:Three barriers to enterprise Python by k8to · · Score: 1

      The "languages that are not type checked" thing is a nice straw man, but it won't wash. Dynamically typed languages are type checked indeed, and in a way which allows for much more robust handling of problems. Statically typed languages allow you to catch a narrow subset of bugs at write time, at the cost of making it harder to catch all other categories of bugs over code bloat, and the cost of making it harder to reengineer your program when needs demand.

      --
      -josh
    16. Re:Three barriers to enterprise Python by Anonymous Coward · · Score: 0

      name one important piece of code that esr has written. his "prose" is documentary at best and the thing he is best known for is being a gun loving sodomy gimp with an appearance and odour most repulsive.

  29. Re:Too bad... by zootm · · Score: 4, Insightful
    "Processors are cheap." and "Disk space is cheap." are horrendous excuses for bad programming. If you have used these expressions to justify your application, you are a bad programmer!
    "Bad programming" has many points to it. I'd include using an old-fashioned language like C or C++ in a system which does not require huge speed or efficiency (which is almost everything these days). It increases the development time of a project, increases the code complexity, increases the chances of runtime bugs, and increases the potential severity of what bugs you do have.

    I'm sorry, but the "but it's slow" argument does not hold for most software designed today. Let's please get over it.
  30. Credit where it's due by hydopower · · Score: 1

    I'm glad to hear it. Python is amazing, and I'd like to see it get the credit it deserves. Whenever I do a big project in it, I'd say I spend about %3 of the time I spend with other languages debugging. About half of that is time spent telling people about how much I love python, because I'm always blown away when every drastically complex feature I implement works perfectly on the first shot. Regarding speed, I've never checked them out, but I'm told there are several ways to dramatically optimize normal python code. Psyco, for instance.

    1. Re:Credit where it's due by Anonymous Coward · · Score: 0

      The 'speed' thing is also a misnomer.

      Taking the same amount of time it takes to crank out a decent Python program.

      Now apply that same amount of time to writing a program in C.

      9 times out of 10 the python program will be faster because unless your able to spend time optimizing and debugging C it's going to be fairly slow.

      Also take into account that if you have a program your writing, like say a DVD player.. you don't do something that needs speed in Python.

      You can write paticular parts of the program in C and load those into a larger framework with Python.

      So for the speed critical parts you have a fast language and for the complex human-interaction and GUI-design part you have Python.

      So you minimalize the risks of using C, but use it for what it is strong at. So you get the best of both worlds.

      A highly optimized Python program would look like a couple hundred lines of code with a few dozen C-built modules thrown in.

      So you use the languages for what they are good at.. it's not Python VS everybody else.. it's Python + everybody else..

  31. We will start to see alot more of it.. by codepunk · · Score: 4, Insightful

    Soon as the qt windows free version starts shipping I think we will see alot of renewed development of gui stuff in python. Currently wxwindows exists but it is a little funky to program in if you ask me. A good industrial strength redily available qt is going to move alot of things.

    It is a great language we use it for everything, web services, linux / win integration, nt services, automation etc.

    --


    Got Code?
    1. Re:We will start to see alot more of it.. by cpghost · · Score: 1

      A good industrial strength redily available qt is going to move alot of things.

      I may burn karma here, but Java's main advantage over PyQt in the GUI arena is Qt's GPL or $$$$ licensing scheme. Most enterprise apps are not intended to be released under the GPL, so it's either Swing for free, or PyQT and a (for small enterprises rather expensive) commercial license from Trolltech.

      Sure, for most companies, $$$$ licensing fees are peanuts, but explain to Mgmt to shell out bucks when you could code that same thing for free using Swing/Java? Yes, much better programmer productivity is the key here, but try to sell that to management first!

      --
      cpghost at Cordula's Web.
    2. Re:We will start to see alot more of it.. by idlake · · Score: 1

      Soon as the qt windows free version starts shipping I think we will see alot of renewed development of gui stuff in python.

      I don't think so. If you develop with Qt, you either have to pay big bucks to Troll Tech up front, or you have irrevocably committed to putting your software under an open source license. Since the latter is usually not acceptable to enterprises (even open-source friendly enterprises), this means paying a lot of money per developer up front.

      Python is often adopted casually, on small projects, and people start to use it more and more from there. A tool that people have to pay thousands of dollars for just to use is not something that gets adopted casually.

      It is a great language we use it for everything, web services, linux / win integration, nt services, automation etc.

      I hope you are either distributing your Qt-based code under the GPL or paying Troll Tech. Which is it?

      Currently wxwindows exists but it is a little funky to program in if you ask me.

      wxWindows is similar to MFC; that may make it "a little funky" from your point of view, but it ought to make Windows programmers happier.

    3. Re:We will start to see alot more of it.. by zorander · · Score: 1

      Once you get used to wxPython, it becomes a very productive environment. I learned Qt first and loved it, but the licensing prevented it from becoming an option. I don't really like the GPL and I don't want to pay large sums of money to trolltech just to create some BSD licensed software. Robin Dunn has done amazing things for the wxWidgets/wxPython world and the libraries he's helped build are beginning to become formidable.

      In an ideal world, there'd be a good implementation of the OpenStep API on all three major platforms. I'd be there in a heartbeat. Cocoa programming is just so..joyous (even/especially in python). Unfortunately, it's confined to the mac.

    4. Re:We will start to see alot more of it.. by neonstz · · Score: 1

      Qt may seem expensive for the hobby developer, but paying ~$2000 per developer for a library which really simplifies multi-platform development in C++ is dirt cheap. I know this is a Python story, but I'd just like to say that using Qt in your C++-programs may very well increase your productivity by a large amount (at least this is my experience). It won't make a bad programmer better, but it will make a good programmer more productive.

    5. Re:We will start to see alot more of it.. by noda132 · · Score: 1

      Soon as the qt windows free version starts shipping I think we will see alot of renewed development of gui stuff in python.

      The GPL is a problem for many people.

      On the other hand, why don't more people use PyGTK? Glade may be a pretty crappy program, but the GUIs you design with it can be great, because GTK has nice widgets. Especially compared to Swing -- coming from a GTK background, I find it next to impossible to design anything remotely similar to a user-friendly interface with Swing. In my (relatively brief) experience, PyGTK has been a dream: everything I ever wanted for RAD.

      PyGTK is licensed under the LGPL -- a lot less of a turn-off to many people than the GPL.

    6. Re:We will start to see alot more of it.. by broward · · Score: 2, Informative

      The rate of growth in python exceeds the other major scripting languages.

      http://www.realmeme.com/miner/java.php?startup=/mi ner/java/scriptinglanguagesDejanews.png

      Python is the only one that has a clear increase in rate of change.

  32. Python & Xcode? by Anonymous Coward · · Score: 0

    Is it possible to use Python with Mac OS X's developer tools and build GUI applications?

    1. Re:Python & Xcode? by Arcturax · · Score: 1

      Not using Xcode or apple's API's.

      But you can use TCL/TK's GUI capabilities, or even Trolltek's QT.

      Since Python can interface with C programs (and I'm guessing, objective C if you worked at it) you could expose Apple's API's to Python if you really wanted to.

      --

      --Won't that be grand? Computers and the programs will start thinking and the people will stop. - Dr. Walter Gibbs
    2. Re:Python & Xcode? by Anonymous Coward · · Score: 0

      See http://pyobjc.sourceforge.net/

      This gives you access to Cocoa from python. I believe you can use Xcode with it as well.

    3. Re:Python & Xcode? by josefkk · · Score: 1

      A Python to Objective-C bridge, which allows for access to Apple's frameworks via Python (and, as for as I know, integration with XCode), has in fact been produced. See: http://pyobjc.sourceforge.net/

      --
      I think therefore I am. Therefore, I think, I am.
  33. How not to win the corporate mind. by NeoBeans · · Score: 3, Insightful
    Take a look at the documentation for PEAK here. Now, take a look at the documentation for J2EE courtesy of Sun (API docs, tutorials, and the specifications).

    For good measure, let's look at the documentation from a J2EE vendor here.

    While PEAK sounds intriguing, I'm not sure that major projects started by Fortune 100 globals will leverage a technology that lacks the level of documentation quality you can find in other products in that space.

    I bring this up because documentation is often an indicator of the level of quality you can expect in terms of support. This is not to say PEAK is bad or poorly written, just that the supporting documentation and resources don't match those available for J2EE implementations.

    Remember -- it isn't the best technology that wins, but the technology that is most accessible. In the case of enterprise APIs, even though PEAK may be easier and more scalable (and this is an excerpt from their page): But PEAK is different from J2EE: it's a single, free implementation of simpler API's based on an easier-to-use language that can nonetheless scale with better performance than J2EE. ...it will need some time and some nurturing in order to compete for mindshare with developers and non-technical decision makers.

    1. Re:How not to win the corporate mind. by dubious9 · · Score: 1

      I have to agree. Java-Doc is one of the best things about java. The API listing is enormously useful and links regularly to the tutorials. Java is simply the most accessible, best documented language/platfrom I've used.

      I do wonder why other languages don't adopt some sort of javadoc. While it may add more verbosity to an already verbose class file, modern editors allow ways to hide arbitrary sections.

      Sun's api listing is vastly easier to navigate then python's , perl outdated man-page style, or even ruby

      Seriously, (and I'm not trying to troll) is there anything better than javadoc? I don't see any drawbacks to it. Why doesn't the rest of the open language community adopt it?

      --
      Why, o why must the sky fall when I've learned to fly?
  34. How about a "REAL WORLD" benchmark, too? by Anonymous Coward · · Score: 0


    C is faster then Python?

    Lets see a performance of data-entry GUI apps for a PostgreSQL database, and in addition you need to export queries over a VPN to a MySQL database used in the backend on a clients website.

    Oh, and it has to be cross platform.

    Person A gets to use C or C++
    Person B gets to use Python
    They both are equaly experianced programmers.

    Lets see who gets it done faster and who is more likely to have bugs and other issues!

  35. Only a few tweaks needed by Nelson · · Score: 2, Interesting
    I think that the database connectivity could be standardized a little more, perhaps with an ORM. It's not bad now but as a postgresql user, I'm not really happy, the "best" connector needs some janked up mx library, there are a few dead connectors. It seems like python.org could take this over or some kind of packager could.


    Then the newer pythons allow you to import from a zip. That needs polish, there should be a standard way to package a whole app in a zip (just to make it harder to screw up the file distribution. Having a single unit that contains all the needed code is a huge positive; it's just that much harder to screw stuff up.


    Then there are people working on compiler speed, really it isn't as bad as you might think from some of the benchmarks. It can use some improvment though and people are working on it.

    1. Re:Only a few tweaks needed by Anonymous Coward · · Score: 0

      Actually, there are efforts to create Python Eggs, which seem to be the equivalent of java's Jars.
      http://peak.telecommunity.com/DevCenter/PythonEggs

    2. Re:Only a few tweaks needed by GlobalEcho · · Score: 1

      I'm about to hook up a Python app to a PostgreSQL database. Last year when I checked, I found that psycopg was the best (fastest and most reliable) connector package. I decided that because it was the only one I tried that didn't choke on huge 500MB loan model runs.

      What do you reckon is currently the "best"?

    3. Re:Only a few tweaks needed by Nelson · · Score: 1

      Psycopg. Nothing is really wrong with it, I'm just not fond of the mxtimedate dependency.

  36. Why is whitespace significance a good thing? by OblongPlatypus · · Score: 4, Insightful

    One thing I've never been able to grasp is why Python proponents always mention the fact that whitespace is significant as a good thing. I guess it could be argued that at least it's not a bad thing, in which case it boils down to a matter of personal taste, but everyone seems to be saying it makes reading unfamiliar Python code so much easier.

    Well, with any other language, if I get a piece of unfamiliar code and have problems reading it due to weird indentation, I just run it through Emacs' indent-region. Can anyone explain to me why this is not just as viable as mandating the indentation policy by embedding it in the language's syntax?

    --
    -- If no truths are spoken then no lies can hide --
    1. Re:Why is whitespace significance a good thing? by blackhedd · · Score: 1

      Whitespace as a block-delimiter makes code easier to read. It's an obvious visual improvement over curly braces. But that's a statement of personal taste.

      Python (and Ruby) are valuable primarily because of dynamic typing. If Python had used curlies rather than whitespace, it would now be a (slightly) worse language but used by far more people.

      By far the number-one reason people avoid learning Python is because they disagree with the whitespace usage on principle.

    2. Re:Why is whitespace significance a good thing? by Anonymous Coward · · Score: 1, Informative

      Why is it a good thing? Because in every modern language, the whitespace *already* matters to the programmer. The problem is that in most languages, it doesn't matter to the compiler. So you have to add the braces. Don't believe me? Here are some classic C:

      if (condition);
      doSomething();

      if (condition)
      doSomething();
      doSomethingElse();

      See? To the programmer, it's the whitespace - the level of indentation. In Python, the language parser is simply smart enough to use that as a guide too - no need for the braces.

    3. Re:Why is whitespace significance a good thing? by TeknoHog · · Score: 1
      If you use both indentation and braces, there is redundancy, which is not a good thing in general. People like to indent code, so in Python it is made a part of the language.

      People use indentation to easily perceive blocks of code. Computers 'prefer' braces for the same goal. But programming languages are meant for the human coder, therefore it's better to use a human way of block delimiting. If you want to serve the machine, use assembler.

      The only problem I've come across with Python's whitespace usage is when tabs and spaces are mixed in the same block. It's pretty bad as it makes debugging hard: to a human, the indentations may look the same, but to the computer, a tab can be different from the corresponding number of spaces. However, it's a pretty pathological case which can be avoided by being generally clean and consistent. Python enforces cleanliness and consistency, which I think is a Good Thing.

      I've had worse experiences when losing a brace in braced languages, than with the above problem in Python. This is of course subjective; but it ties in with my observation that Python is much more human-readable because of fewer punctuation characters. It's closer to a natural language or pseudocode, which should be something like a holy grail for programmers.

      --
      Escher was the first MC and Giger invented the HR department.
    4. Re:Why is whitespace significance a good thing? by arevos · · Score: 2, Insightful
      I find it reduces clutter in my code. For instance:
      if (x == 2) {
      printf("Blah blah");
      }
      As opposed to:
      if x == 2:
      print "Blah blah"
      The question is not so much why one should have a language with whitespace significance, but why one should not. Since the vast majority of well-written programs use whitespacing in this manner already, it makes some sense to do away with braces and semi-colons when they're not really needed.
    5. Re:Why is whitespace significance a good thing? by krumms · · Score: 4, Informative

      One thing I've never been able to grasp is why Python proponents always mention the fact that whitespace is significant as a good thing.

      Whitespace (or more specifically, indentation) significance forces you to make the visual structure of your code match its semantic structure.

    6. Re:Why is whitespace significance a good thing? by Bob9113 · · Score: 1

      Well, with any other language, if I get a piece of unfamiliar code and have problems reading it due to weird indentation, I just run it through Emacs' indent-region. Can anyone explain to me why this is not just as viable as mandating the indentation policy by embedding it in the language's syntax?

      I think maybe you're just looking at it from a different angle than the proponents. The upside of whitespace-based scoping lies in the assumption that we now all use advanced editors like Emacs or IDEs, and so we all now have automatic indent controls. Given that, curly braces are now redundant - the whitespace already contains the block scope information. The curly braces are repetitive - they just restate what the indent already does.

    7. Re:Why is whitespace significance a good thing? by Anonymous Coward · · Score: 0

      visual structure of your code match its semantic structure

      That's great and all, but what happens when you are working with code that several programmers have worked on, all of which have different tab settings and some of which used spaces, some used tabs. Python is fine for small jobs, but it doesn't work as well for larger jobs.

    8. Re:Why is whitespace significance a good thing? by torok · · Score: 1

      Not only that, but your white space can be spaces OR tabs - either one will work, but if you use both the code breaks. I'm a Java guy who tried jython for a couple of months. Don't know what all the fuss is about, I couldn't stand using jython.

    9. Re:Why is whitespace significance a good thing? by Anonymous Coward · · Score: 0

      if (condition)
      doSomething();
      doSomethingElse();


      Actually what if in front of doSomething(); there are spaces and in front of doSomethingElse(); there is one tab. Oops, whitespace isn't always = white space.

    10. Re:Why is whitespace significance a good thing? by Anonymous Coward · · Score: 0

      Can anyone explain to me why this is not just as viable as mandating the indentation policy by embedding it in the language's syntax?

      Generally Python programmers are working on smaller projects with small groups (usually of 1). That is the nature of the language. It doesn't scale, but it isn't made to scale either. So you won't be gettin an answer. Once you get into projects where you spend more time architecting and debugging than you spend actually writing code, Python starts sucking very hard (as to all scripting languages I've ever work with).

    11. Re:Why is whitespace significance a good thing? by Berfert · · Score: 2, Interesting

      My issue with using indentation as a block delimiter is in the time it takes to do it. When programming in Tcl (my language of choice), I just hit tab and the code is indented to where it should be. If I add an open or close curly, the indentation knows where to go next (in order to be the most readable to me). How do Python programmers handle having to indent every line? I assume tab will (generaly) indent to whereever you were last indented to. Do you need to backspace/space mutliple times each time you switch to a new block level?

    12. Re:Why is whitespace significance a good thing? by mrandre · · Score: 1

      Because there is a freedom in constraints. If I sit down to write a story, and I can do anything, write about anything, my brain tends to lock up. There are just too many choices. By applying constraintns, I give myself a workable whole in which to work. Put simply, humans don't do well with infinity. So by reducing the problem space, there is more energy on what is actually in play. Which leads to the obvious question: Why should style _ever_ be in the problem space? Why should style be a choice? In what way does writing my french brackets on seperate lines instead of with the first on the same line as the declaration make any difference to whether my strings get concatenated properly? The answer, of course, is that they don't. I balked at first, but the more I use it, the more I appreciate usinng python, and not having to bother with style. I can focus on solving problems, and that's as it should be. That and I hate emacs. ;-)

      --
      "I don't want to achieve immortality through my work. I want to do it by not dying." -Woody Allen
    13. Re:Why is whitespace significance a good thing? by platypus · · Score: 1

      Do you need to backspace/space mutliple times each time you switch to a new block level?

      No, most of the editors (not also python enabled ones) don't work that way:
      indenting: press TAB
      dedenting: press backspace

      on save: convert the TAB to spaces.

      Editors with python syntax support (like emacs,vim, etc. etc.) autoindent if you type something like:
      def methodname(): and hit enter.

    14. Re:Why is whitespace significance a good thing? by krumms · · Score: 1

      That's great and all, but what happens when you are working with code that several programmers have worked on, all of which have different tab settings and some of which used spaces, some used tabs.

      Easy: the code won't run. Python doesn't try to guess between which two you're using, it more than likely just plain won't run.

      From the moment you start writing Python code you should be aware that whitespace is a part of the Python grammar - just like curly braces are part of the C/C++/Java/Perl grammar, just like brackets are part of the scheme/lisp grammar. As such, you need to be aware that when you write Python code: white space matters.

      People complain about this all the time, but they're usually people who've had extremely limited experience with Python.

      Python is fine for small jobs, but it doesn't work as well for larger jobs.

      Completely unfounded.

    15. Re:Why is whitespace significance a good thing? by zorander · · Score: 1

      I'm usually happy with python's whitespace significance, but I can think of a few cases where you don't want it. Think about html/xml generation. Semantically you want this.

      emit_tag("html")
      emit_tag("head")
      emit_tag("title",content="%s"%title)
      emit_tag("head")
      close_tag("html")

      You're forced to write that like this:

      emit_tag("html")
      emit_tag("head")
      emit_tag("ti tle",content="%s"%title)
      emit_tag("head")
      close_ tag("html")

      which I find to make much less sense. Another one is OpenGL where you really want to indent when you push something onto the stack. To be fair, people have made tag libraries using __getattribute__ which lend to very readable code. I don't think you could use that for GL and GL-like situations, though.

      And for those noting spaces/tabs problems, yes they're real. I generally start editing a python file from someone else by figuring out how to deal with whitespace. There's a solution to this--don't let people choose between spaces or tabs. This unfortunately means forcing spaces, but it means that the code can never deceive because of different tab/space setups, etc. YAML does it this way (spaces-only) and though it's a bit annoying (as I've always been on the tabs side of the fence), it does work.

    16. Re:Why is whitespace significance a good thing? by Sunspire · · Score: 1

      With a good editor you don't even think about the identation, it's all taken care of automatically. For example in Emacs Python mode as you type ':' the next line will automatically be correctly indented. It's also impossible to indent too much, pressing tab does nothing as you're already at the correct level. As a result you don't really use tab much at all.

      The level of indentation is kept for all subsequent lines untill you press backspace, which closes the "block" and decreases the indentation. Reindenting an existing piece of code (for example when moving it into a function or loop) is also foolprof, you just press tab anywhere in the line and the correct indentation level is determined from the context.

      It's really very intuitive once you try it.

      --
      It's like deja vu all over again.
    17. Re:Why is whitespace significance a good thing? by jez9999 · · Score: 1

      Yes, and in practice too.

      I've never had problems with people using curly braces as block delimiters. I love it. If you have problems reading it, frankly I don't have much sympathy. I don't, so get better at reading code.

      I have, however, had nasty problems caused by whitespace significance, and it seems like a really stupid thing to make significant, considering that whitespace is a favourite for all sorts of programs to modify/chop away, as well as being invisible without close inspection.

    18. Re:Why is whitespace significance a good thing? by Trifthen · · Score: 2, Insightful

      No, actually... it doesn't. I've seen python code that uses *only* the indentation rule - there was no other extra whitespace or comments anywhere. Not between functions, not between class declarations, not between loops, nowhere. Not only was this code unreadable, but it proved to me that you can't make someone a good programmer by enforcing semantic rules in the language. While we're at it, why not build a language that enforces javadoc-style comments at a rate of 40% or more to code? How about one that enforces a standard naming scheme on variables?

      Personally, my code usually has a giant comment at the top describing the purpose of a class/library, a reference implementation, and version information. Before any significant chunk, I write out what I'm doing, and why - in case I ever have to read it again in the future. in the end, my code is probably half comments. This is good programming practice in general, and so few people do it that it makes me want to cry. Anybody, and I mean anybody, can pick up some of my code and figure out what's going on.

      *That* is why I think python's enforcement of whitespace is a pointless anachronism. Good programming is good programming. Remember when Java said making everything an object meant everyone had to use objects properly? No, it meant old functional programmers would make a huge class, call it "UtilitiyClass" and use it like a library. You simply can not make good programming practice magically appear via language rules.

      So yeah. I'll continue to roll my eyes when people mention python. No single attribute transforms an otherwise commonplace language into greathood. It's just another tool to me, with a weird limitation I could care less about, since it never applied to me anyway. Yeah, my code style would work in python; it also works in ada, c/c++, java, perl, php, and every other language I've used.

      Python's cross-platform compatibility and somewhat extensive library are another point entirely. Why not push those elements instead? They actually mean something to good programmers who wouldn't give two figs about python's Awsome Whitespace Rule(tm).

      --
      Read: Rabbit Rue - Free serial nove
    19. Re:Why is whitespace significance a good thing? by jez9999 · · Score: 1

      Hmm. If you think about it, you could enforce tabs too. If there's one thing that's guaranteed about a tab, it's that it's going to cause the cursor to move right. Apart from that, you don't really care - how far does it travel? Doesn't matter. In fact, this seems a slightly better way to do things because, as someone said above, it means that you can set tab sizes to whatever you want in your editor to look best for you. All you care about is that a tab causes *some* sort of movement to the right.

    20. Re:Why is whitespace significance a good thing? by Surt · · Score: 1

      To call this one of the significant advantages of the language is stupid. There have been reformatting editors for all the major languages for over 6 years now. And as others have pointed out, the forced semantic whitespace rules also make translations to other systems not look structured even when they may be.

      --
      "Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
    21. Re:Why is whitespace significance a good thing? by Trifthen · · Score: 1

      Don't forget "emulate". My editor, and in fact any editor I will use, is set to display all indentation as two spaces, and convert any tabs to two spaces. If I press tab, I also get two virtual spaces that don't really exist until I actually type something on that line. It means all code looks the same to me, no matter how many tabs vs. spaces it may contain. Other people though...

      Really, there is no point. A good editor will hide inconsistent spacing, so why bother?

      --
      Read: Rabbit Rue - Free serial nove
    22. Re:Why is whitespace significance a good thing? by jez9999 · · Score: 1

      People use indentation to easily perceive blocks of code. Computers 'prefer' braces for the same goal. But programming languages are meant for the human coder, therefore it's better to use a human way of block delimiting.

      No, that's a non sequitur. We don't use English to write computer programs; why not? Because there'd be ambiguity in the language.

      Programming languages have as their (probably) #2 goal being easy to read to humans. But surely the #1 goal is to avoid ambiguity, computers ain't gonna stand for ambiguity. Introducing whitespace introduces ambiguity, at least visually to the programmer. I say that's a step backward.

    23. Re:Why is whitespace significance a good thing? by jez9999 · · Score: 1

      That's why I think people who don't use curly braces and put a block statement on a new line should be shot. I either use braces, or put a single statement on the same line as the if/else. Yours is a problem that can be avoided by being generally... clean and consistent. Ah, but that's the very same argument used by Python programmers for whitespace, turned on its head!

      If anything, I think languages should go the other way, and enforce *non-whitespace* block delimiters.

    24. Re:Why is whitespace significance a good thing? by Trifthen · · Score: 1
      You might want to try another example. Almost every language out there currently considers an if statement a precursor to an element. An element may consist of one statement, or a block of statements. Thus in your example, the first if does not require the curly braces. Had you used two statements in the block, your point would stand.

      The semantic meaning of {} is "consider anything in here, part of a single element." One would even argue that it makes more sense, since you can say that anything within the curly braces, belongs with the if statement. With only indentation, what happens when you have two if statements that are many pages long? You scroll until you find something not as indented as the rest, prefixed with "if, while, for, etc." But where does your block end?

      When I end a {}, I always append a statement about what I'm ending:
      // ... 100 lines of code ...

      } // End wombat smacking block.
      How would you do that in a language with no explicit block delimiter? I find languages like Ada the ideal, since they force you to say what block element you are terminating. Does that mean they're inherently better, somehow? Sure, it's more "clutter", but it conveys meaning. You sound like the kind of person that may describe commenting as clutter - in which case, stay away from me, foul beast. ;)

      Now, call me when python enforces 40% commenting, standard variable, function, and class naming schemes complete with javadoc-style interface declaration headers, and named blocks, and I might care. Otherwise it's Just Another Language(tm).
      --
      Read: Rabbit Rue - Free serial nove
    25. Re:Why is whitespace significance a good thing? by TeknoHog · · Score: 1
      Introducing whitespace introduces ambiguity, at least visually to the programmer. I say that's a step backward.

      I fail to see how whitespace is somehow inherently ambiguous. The problem I mentioned is sort of related to ambiguity with whitespace, but its origins are in generally sloppy programming (you can get into similar trouble with braced languages as well).

      In Python, each line of a block has to be indented in the same way. If you do just that, there is no ambiguity.

      --
      Escher was the first MC and Giger invented the HR department.
    26. Re:Why is whitespace significance a good thing? by Berfert · · Score: 1

      So, the : is used to specify a block indent? How is that different from a {? Also, what happens if you want to indent differently for continued lines than you do for blocks? It seems to me that differnt people like things different ways. Forcing one style on people doesn't seem to do anything but reduce everyone to the lowest common denominator... one person's style.

    27. Re:Why is whitespace significance a good thing? by MostlyHarmless · · Score: 1
      If you're only using tabs, how are you going to implement this handy indentation scheme?
      if x == 5 or ((i < 4 or i > 6)
      and (i+a < 4 or i+a > 6)):
      You can't do that with only tabs. You can do it with tabs and spaces, but only if you assume that a tab is 8 characters wide, which breaks the original idea of allowing everyone to set their tab width.

      If everyone only uses spaces, such problems don't crop up.
      --
      Friends don't let friends misuse the subjunctive.
    28. Re:Why is whitespace significance a good thing? by Anonymous Coward · · Score: 0
      Well, with any other language, if I get a piece of unfamiliar code and have problems reading it due to weird indentation, I just run it through Emacs' indent-region. Can anyone explain to me why this is not just as viable as mandating the indentation policy by embedding it in the language's syntax?
      That's fine if all you want to do is read the source code, but bulk-reindenting wreaks havoc on diff/patch and source control systems. To do it on a living project, you basically have to create your own fork, or commit to a huge amount of time babysitting patches.
    29. Re:Why is whitespace significance a good thing? by MostlyHarmless · · Score: 1
      How would you do that in a language with no explicit block delimiter?
      def do_stuff()
      i = mangle()
      # Babble on for a hundred lines or so
      frob_i()
      frob_i_again()
      ...
      frob_i_one_last_time()
      #end do_stuff()
      Or, you can go one better...
      if i: #{
      do_stuff()
      #}
      ;-)

      --
      Friends don't let friends misuse the subjunctive.
    30. Re:Why is whitespace significance a good thing? by eddeye · · Score: 1
      Whitespace (or more specifically, indentation) significance forces you to make the visual structure of your code match its semantic structure.

      Tired of Perl's quirks, I finally switched to Python a couple years ago. I absolutely love it. However the whitespace issue still bugs me. The argument about it forcing good visual structure rings hollow. Naming constants with ALL CAPS is good practice too, but I don't know of a single language which forces you to do so. Yet somehow everybody does it.

      In my book, conventions should be encouraged, not enforced. Sometimes the rules need to be broken. For example, say I want to add a temporary statement to a block of code (for debugging or otherwise). I only want it for a few runs then I'll remove it. In other languages, I can put such statements flush left where they stick out like a sore thumb, making them easy to remove later. Python doesn't allow that.

      It comes down to a philosophical difference. I prefer giving people structural freedom over their code. Good programmers use the freedom well, following conventions when they promote understanding the code, and breaking them when they inhibit it. Breaking a convention is a good sign something weird is going on, so that code should be inspected more carefully. Python's whitespace allows no such visual clues.

      Bad programmers will write bad code in any language. Good indentation may make it more readable, but it won't be any more intelligible. And there are automated tools for indentation. Why hamstring all programmers for the sake of saving a few reformatting cycles on pathological cases?

      The whitespace has little to do with why Python code is so intelligible. I've read tens of thousands of lines of code in other languages and the vast majority is indented properly too. What makes Python so intelligible is the lack of surprises. The core language is small and behavior is consistent -- there are almost no special cases where semantics change. Contrast with C++, where identical syntax can cause radically different behavior depending on whether Section 58 Paragraph 29 Clause 11 of the C++ Standard applies or not.

      That said, if you use a Python-aware editor like vim/emacs and run with the -tt option, you'll rarely run into the whitespace issue. In practice it doesn't bother me so much.

      --
      Democracy is two wolves and a sheep voting on lunch.
    31. Re:Why is whitespace significance a good thing? by hgiddens · · Score: 1

      One thing I don't understand about the debate on whether white space should be important is why nobody seems to like Haskell's model. Unfortunately I'm too rushed to dig up an example, but basically you can either have white space determine block structure or have curly braces and semicolons. It's certainly the way I prefer it.

    32. Re:Why is whitespace significance a good thing? by Mr_Icon · · Score: 1

      It's not "whitespace significance," it's "syntactic indentation." The difference is--whitespace is only significant as a logical level marker at the beginning of the line. After that it doesn't matter how much whitespace or where you put it.

      --
      If you open yourself to the foo, You and foo become one.
    33. Re:Why is whitespace significance a good thing? by Anonymous Coward · · Score: 0

      Well - for one, it forces you to write readable code. It's a little hard to Obfusgate Python code, but I wouldn't be surprised of some people actually figure out how.

      The thing I really like about Python is how interactve it is, and how it encourages me to experiment. If something don't work,
      it don't get added to the overall project.

      Personally, I use a sort of "worksheet", where I type in small, easily testable code fragments, copy and paste it into the Python Interpretor to instantly try it... Although I've used the
      source level debugger, I hardly ever have to use it.

      Once I've compiled up my "worksheet", it's a simple task of
      bundling them up into usable modules of "already tested" code.

      I just replace the working code with an "import "
      and continue development.

    34. Re:Why is whitespace significance a good thing? by the+eric+conspiracy · · Score: 1

      why Python proponents always mention the fact that whitespace is significant as a good thing

      They always mention it in the hope that if they say it often enough you will eventually believe it. In reality invisible syntactic elements is plain stupid.

      All I can say (and I've used both languages) is that Python does some things very nicely, However that does not make it a language suitable for enterprise programming - libraries are thin, IDE's are very thin, implicit variables are unacceptable and the global interpreter lock is a an automatic disqualification if you need multithreading.

    35. Re:Why is whitespace significance a good thing? by noda132 · · Score: 1

      One thing I've never been able to grasp is why Python proponents always mention the fact that whitespace is significant as a good thing.

      Yes, we all felt like this at one point. Try Python for one hour and you will love its treatment of whitespace for the rest of your life.

    36. Re:Why is whitespace significance a good thing? by k8to · · Score: 1

      Wow, you found a single counterexample! I guess that disproves the ENTIRE REST OF THE BODY OF CODE.

      --
      -josh
    37. Re:Why is whitespace significance a good thing? by vidarh · · Score: 1
      The thing is you DO have to bother with style. You just have to bother with a style you don't have any say in. If you are happy with that, then you could just use any editor that allows you to enforce a specific style instead of picking a language that forces a specific style on you. I find Python syntactically disgusting. It keeps me from considering it as a language I'd like to work in because I consider the syntax ugly and painful.

      Syntax is one of the important factors in choosing a programming language. It DOES affect how you work with the language more than many people realise. A syntax that looks pleasing to me makes me focus on the problem. A syntax I don't like frustrates me and slows me down.

      When a language has a syntax that is flexible enough for me to be able to adapt it to what I find estetically pleasing, I am more likely to enjoy working with it.

      The whitespace issue will keep on keeping a lot of people away from Python.

    38. Re:Why is whitespace significance a good thing? by arevos · · Score: 1
      When I end a {}, I always append a statement about what I'm ending:
      // ... 100 lines of code ...

      } // End wombat smacking block.
      How would you do that in a language with no explicit block delimiter?

      Um, like this?
      def wombatsmack():
      100
      lines
      of
      code...
      # end wombatsmack block
      I can't see what readability a single brace adds to a program.

      I find languages like Ada the ideal, since they force you to say what block element you are terminating. Does that mean they're inherently better, somehow? Sure, it's more "clutter", but it conveys meaning. You sound like the kind of person that may describe commenting as clutter - in which case, stay away from me, foul beast. ;)

      It's true that I tend to use very little comments in Python, but that's because doc-strings are often enough. I tend to be of the school of thought that favours splitting a program into many small functions that do one thing and one thing only.

      Clutter I define as elements of a program that don't add much information to your code. Semicolons are often clutter; you only truly need them in the very rare instances where you might want to put more than one instruction upon one line. Braces are clutter, at least to me, because whitespacing does the job much better. I suspect I'd have no objection to languages like ADA in theory, but I suspect I'd soon grow weary of typing out end block delimiters :)

      I've also never had a problem with knowing where Python blocks end, either. But then again, I've never had a situation where I've had a blocks that are 100 lines long (except with classes, but it's pretty simple to see where they end :). Python's whitespacing method is optimum for me, but your mileage may vary.
    39. Re:Why is whitespace significance a good thing? by vidarh · · Score: 1

      If you have blocks of code spanning more than a page, then you have a much bigger problem to sort out than whitespace vs. culy braces. I hate significant whitespace and much prefer braces, but if I see blocks of code spanning page boundaries I'll start wondering what kind of idiot wrote the code...

    40. Re:Why is whitespace significance a good thing? by vidarh · · Score: 1
      Naming constants with ALL CAPS is good practice too, but I don't know of a single language which forces you to do so. Yet somehow everybody does it. AmigaE is a language that had all sorts of restrictions on the casing of various syntactic elements. I liked the syntax, but I didn't like the restrictions, because while they worked for me it's the kind of thing (like Python's whitespace abuse) that will put groups of people off a language because they happen to hate the syntactic restrictions.

      In Amiga E's case, some of the justification was that it simplified the parser a lot (and seeing as the compiler was entirely written in M68000 assembly that might have been a good thing...)

    41. Re:Why is whitespace significance a good thing? by kavau · · Score: 1

      With a properly indented C++ program (for example), you have to mark each block twice: once using delimiters ('{', '}'), and once again using indentation. Python eliminates the redundant delimiters, hence making the code simpler and more elegant. Plus, you can't stumble as easily over spurious missing brackets.

    42. Re:Why is whitespace significance a good thing? by Anonymous Coward · · Score: 0

      OK, I'll bite.
      - fewer symbols (no {} everywhere) makes it easier to parse mentally
      - no arguments about what {}-style to use
      - people read based on indentation, anyway, so by forcing them to be the same, you can't have misleadingly-indented code
      - no } on their own line means I can fit more lines of code on screen at once
      - there are a lot of places you can't use Emacs' indent-region; for example, browsing something on a CVS server on the web, looking at a printout, or processing files with diff or grep
      - a policy mandated by The Boss is never taken quite as seriously as a policy mandated by the compiler

      Turn the question around. Take somebody who's only ever programmed in Python. Can you convince him why you'd have the programmer insert { } everywhere? It'd be completely redundant, and only allow people to write code with screwy and misleading indentation. I think that's one sign that it's a good thing: once you use it, you can't imagine switching back.

    43. Re:Why is whitespace significance a good thing? by Anonymous+Brave+Guy · · Score: 1
      ...if I see blocks of code spanning page boundaries I'll start wondering what kind of idiot wrote the code...

      Possibly someone who's better informed than you. The idea that a "good" function size is a function that fits on a single screen is a popular one, but rarely backed up by evidence when objective studies are done. See, e.g., Steve McConnell's Code Complete for a fuller survey of the research.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    44. Re:Why is whitespace significance a good thing? by Anonymous Coward · · Score: 0

      I'm actually somewhat of a fan of Python but the issue of whitespace is something that gave me serious reservations.

      On more than one occasion, I've spent a significant amount of time debugging a Makefile only to find that in one line there was a tab and in another a series of spaces that looked identical (granted, a good editor / IDE will help but as long as a tab is indistinguishable from a series of spaces, there will be an ambiguity and potential source for headaches).

    45. Re:Why is whitespace significance a good thing? by Anonymous Coward · · Score: 0

      WHAT BODY OF CODE? The GP has a hell of a good point. You don't.

    46. Re:Why is whitespace significance a good thing? by Trifthen · · Score: 1

      You're right. Libraries never have more than one function in them, and functions are never more than 100 lines.

      What was I thinking?

      --
      Read: Rabbit Rue - Free serial nove
    47. Re:Why is whitespace significance a good thing? by k8to · · Score: 1

      The point is: the vast mojority of python is highly readable and not explicitly or overly obfuscated in style. The natural style of the language is actually quite open and concise. He managed to find a single example of python which is hard to read DESPITE the nature of the language, and uses this to insist that having a language which encourages clarity is quixotic.

      This is clearly stupid, because if you pull 99.9% of python code out of projects, off the internet, etc you will find that the syntax exudes this property of conciseness which python supports strongly.

      Was that clear enough for you?

      --
      -josh
  37. Meet Zope and Plone! by blueZhift · · Score: 1

    I remember when I first heard of Python back in grad school. I wondered what would become of it, but didn't have time to deal with it at the time, after all FORTRAN was teh cool, right? Lately, since I started using Zope, which is written in Python, and more recently Plone, which is built on Zope, I've really gained a great appreciation for Python because it really has made building sophisticated logic for web apps a lot easier than some alternatives. Now admittedly, I did not choose any of these because I heard they were easy or even cool, I stumbled into Zope because of an app, OIO, that I thought I could build on for another project. Later I heard about Plone and decided that I could build an easier to use portal for clinical investigators using that rather than PHP based solutions like PHP-Nuke. Python was just the icing on the cake as I discovered how much I could do with it.

  38. No CPAN. by furry_wookie · · Score: 1

    Call me when Python has CPAN's 7848 modules. Then we can talk about "productivity".

    --
    -- Given enough time and money, Microsoft will eventualy invent UNIX.
    1. Re:No CPAN. by srid · · Score: 1

      Call me when Python has CPAN's 7848 modules. Then we can talk about "productivity".

      There are several CPAN-for-python projects. Uraga is one of them.

      Actually lack of CPAN like thing is not anymore a disadvantage for python. You have much more packages for python that satisfies various needs, what else do you miss. If you need to install any of them, just run the installer in windows or use rpm/apt in Linux. In fact, integrating with your OS/Distro's package manager is much better than a solution like CPAN

      --
      - srid
    2. Re:No CPAN. by rakanishu · · Score: 2, Interesting
      Call me when Python has CPAN's 7848 modules. Then we can talk about "productivity".
      I hear this over and over, but I have to wonder what percentage of CPAN's 7848 modules are actually used? Which ones have been replaced by better ones?

      Python has PYPI which is growing. Python also comes with a pile of standard modules. I'll admit something closer to CPAN would be helpful. On the other hand, I haven't had any issues finding modules. Sometimes all you need to do is google or ask on one of the python lists.
  39. Python Moving into the Enterprise by rookworm · · Score: 1

    Set phasers for stun.

    --
    The toad can't burp - and for some reason can't fart either, so it swells up and eventually explodes. --Anonymous Coward
  40. What would you call it? by Rhinobird · · Score: 1

    I mean "J2EE" is a good name, but the Python equivilent "PEE", is missing something.

    For some strange reason, I, suddenly, have to use the bathroom...

    --
    If Mr. Edison had thought smarter he wouldn't sweat as much. --Nikola Tesla
    1. Re:What would you call it? by Anonymous Coward · · Score: 0

      The same thing happens with Perl. With C#, C++ and C you get something almost as stupid: CEE (or maybe C#EE). I hate to think some marketing geek at Sun planned it like this all along...

  41. Still struggling with Python...look here! by Anonymous Coward · · Score: 0

    Obligatory PC Weenies webcomic about one Python developer's personal struggle...

  42. Java / Python / Ruby by linuxbaby · · Score: 4, Funny
    This article confirms it...
    • Ruby is the new Python
    • Python is the new Java
    • Java is the new COBOL

    :-)
    (found many places online...)

    1. Re:Java / Python / Ruby by ahmetaa · · Score: 1

      Actually, Java is the new C++ Ruby , Python are the new Perl..

    2. Re:Java / Python / Ruby by Anonymous Coward · · Score: 0

      Python is the new Java

      I've been saying this for a while now. Check out these Java-like qualities of Python:

      large confusing standard library? Check.

      Lightweight syntax but you still have to write 50 lines to get what you want done? Check.

      Extremely popular with newbies who have discovered it's Better Than What They Were Using Before (tm) (even though they haven't used any *really* powerful languages)? Check.

      Tons and tons of crap code available for free download, including bloated web frameworks? Check.

      Authors claim they are "doing it object-oriented" even though their code is mostly procedural? Check.

      Python is Open Source's Java, make no mistake about it.

    3. Re:Java / Python / Ruby by Anonymous Coward · · Score: 0

      java is the new c++
      ruby is the new perl
      python is the new lisp

    4. Re:Java / Python / Ruby by Anonymous Coward · · Score: 0

      C# is the new java
      Java is the new C++
      Ruby is the new perl
      Python is the new sh
      Lisp is the same old lisp

      And they all suck, and they all suffer from hard-core zealots.

    5. Re:Java / Python / Ruby by shutdown+-p+now · · Score: 1

      It would be funny if it weren't so true.

    6. Re:Java / Python / Ruby by Anonymous Coward · · Score: 0

      Unfounded FUD troll? Check.

    7. Re:Java / Python / Ruby by istartedi · · Score: 1

      Hmmm... in 1997 I was often heard to remark "my goal is to get through my entire career without learning Java". So I guess now I need to add Python to that. Oh, and I love all these people saying speed doesn't matter. More job security for people like me who can come in and re-implement stuff in C or C++ because management is tired of being told they need a dual processor Xeon to run stuff that runs on a Celeron when it's done right.

      --
      For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
  43. Recursion by saigon_from_europe · · Score: 1
    Ok, the test description says that its task is to show the performance of recursion.
    Or, even better, idea should be to show the performance of the problem that is typically solved by recursion. If you can make qsort to work without recursion (I haven't tried this, they say it is very hard to do) and code is still reasonably readable, that's it. But I don't see the value of recursion per se, it is tool just like every other. If you have replacement for the tool, I won't make you a problem as long as problem is solved.

    (I write this under assumption that Fibonacci numbers can be more easily calculated without recursion, although I am not sure if I am right.)
    --
    No sig today.
    1. Re:Recursion by colinrichardday · · Score: 2, Insightful

      The nth Fibonacci number:

      Let a be the sum of 1 plus the square root of 5, all divided by 2. Let b be the difference of 1 minus the square root of 5, all divided by 2. The nth Fibonacci number is a to the nth power minus b to the nth power, all divided by the square root of 5. Should be in any text on number theory.

      So yes, one can calculate Fibonacci numbers nonrecursively.

    2. Re:Recursion by rbarreira · · Score: 1

      Any problem which is easy to code recursively is also easy to do iteratively - you just have to implement the stack part yourself...

      --

      The AACS key is NOT 0xF606EEFD628B1CA427BEA93A9CA9773F
    3. Re:Recursion by Anonymous+Brave+Guy · · Score: 1

      In fact, any algorithm that you can implement at all using recursion can also be implemented iteratively, assuming we're talking about a sane computation model.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    4. Re:Recursion by rbarreira · · Score: 1

      That's what I meant :)

      --

      The AACS key is NOT 0xF606EEFD628B1CA427BEA93A9CA9773F
  44. Re:Too bad... by Anonymous Coward · · Score: 1, Insightful

    I'm sorry, but the "but it's slow" argument does not hold for most software designed today. Let's please get over it.

    No, it is I that is sorry. Right now, your thinking is prevailing. Slow, crappy software is being pumped out left and right by programmers that are either too lazy to do it properly or they simply don't have the ability to do it properly.

    The fact that most software today is poorly written and is slow is a very sad fact that I can't "get over". Perhaps, one day, you will.

  45. The joke in the example is subtle. by hey! · · Score: 1

    The example could be written in Java as:

    public class Hello
    {
    public String myName="Monty";
    public static void main(String[] args)
    {
    System.out.println("Hello " + myName);
    }
    }

    Which is just as short, if not shorter (depending on how you measure length) as the Python example.

    The joke, to my mind, is not on Java, but on Java developers' tendency to overengineer everything in sight. Once you move these people over to Python, you'll be seeing the same joke with Python on the right side and Ruby or Groovy on the left.

    People in the "scripting" lanuage camp by contrast have more of a "just make it work" attitude. To my mind, neither of these attitudes is perfect. Getting this right involves experience and judgement -- you have to look at the big picture. The kind of person who can be consistently successful using scripting (or "dynamically typed" ) technology is likely to be quite capable of having the same success with Java, and vice versa.

    --
    Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    1. Re:The joke in the example is subtle. by Anonymous Coward · · Score: 0
      Well your code is structured rather differently than Python example. Python code that is closer to the structure that you are using would be:
      myName="Monty"
      print "Hello", myName
      Looks shorter to me.
    2. Re:The joke in the example is subtle. by hey! · · Score: 1
      Not really, because you don't have a Hello class you can manipulate. My example is an exact replica of the Python example, which originally linked example was not.


      In any case, it's stupid to look at extreme cases for comparing the complexity of two languages -- you have to look at common cases.

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    3. Re:The joke in the example is subtle. by Anonymous Coward · · Score: 0

      An exact replica? I don't think so. Sadly, the original code would be closer to an exact replica. Sorry.

      And what really matters is not how many non-whitespace characters there are because a person types at pretty much the same speed no matter what language they are doing. In fact, people tend to put out the same amount of characters a day regardless of which language they are using- so a language where you type fewer characters can be more productive. This might seem simple or possibly a red-herring but there have been studies done that prove this.

    4. Re:The joke in the example is subtle. by Anonymous Coward · · Score: 0
      Your example is a far cry from being an exact replica of the Python example.

      The closest thing that I can thing of as an exact replica would be:
      public class Hello
      {
      String myName="Monty";

      void sayHello()
      {
      System.out.println("Hello "+myName);
      }

      public static void main(String[] args)
      {
      Hello h=new Hello();
      h.sayHello();
      }
      }
    5. Re:The joke in the example is subtle. by Anonymous Coward · · Score: 0

      An exact replica? Where is your sayHello method for your Hello class then? I think someone has been fibbing.

    6. Re:The joke in the example is subtle. by hey! · · Score: 1

      An exact replica? I don't think so.

      Well, then, if you were interviwing with me for a programmer position, you wouldn't pass go.

      The creation of a new class is, I think, an important side effect of the original Python program ;-) Just because running the python counterargument to my original post, as a stand alone program, gives the same output doesn't mean it accomplishes the same thing. The reason you would't get the position if you interviewed with me is that working on a program until it gives the right output in a single test, then figuring you're done is a tyro nistake.

      And what really matters is not how many non-whitespace characters there are because a person types at pretty much the same speed no matter what language they are doing

      In my opinion, this matters a bit, but not very much.

      In fact, people tend to put out the same amount of characters a day regardless of which language they are using- so a language where you type fewer characters can be more productive

      This is about the silliest assertion I've ever heard. Yes, terseness matters, but the real win in Python is not its lexical terseness, but it's syntactic terseness. This comes from having the concept of collections built into the language.

      There is no productivity difference between typing a left curly brace and hitting the tab key. The main win in this is in reading since reasonable indentation is enforced and visual clutter is reduced.

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    7. Re:The joke in the example is subtle. by quantum+bit · · Score: 1
      The example could be written in Java as:

      Um, not really. That won't even compile the way it's written. main is a static method, which means that it can't access the myName member. There's no instance of the Hello class. If you made myName static as well, it would run but would be closer to the following python:
      myName="Monty"
      print "Hello " + myName
      And the whole Hello class would only exist as a result of Java not allowing you write pure procedural code outside of a class.
    8. Re:The joke in the example is subtle. by hey! · · Score: 1

      Yes, that's more correct.

      However, the point still stands, the example linked artificially inflates the "complexity" of the java example. In my opinion this is no more or less readable than the Python example. And I'm known among my friends as a Python supporter.

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    9. Re:The joke in the example is subtle. by Anonymous Coward · · Score: 0
      We I was not arguing about the complexity of Java. I just found your example wrong, and ordinarily would not have said anything except for you insistance that it is right.

      Of course, the Python code could be simplified a little too:
      class Hello:
      myName="Monty"
      def sayHello(self):
      print "Hello", self.myName

      h=Hello()
      h.sayHello()
      I totally agree that there is really no difference in clarity between the Java and Python versions. If forced too though I would probably say that the Python example is easier to write.
    10. Re:The joke in the example is subtle. by Anonymous Coward · · Score: 0
      Well, then, if you were interviwing with me for a programmer position, you wouldn't pass go.

      The creation of a new class is, I think, an important side effect of the original Python program ;-) Just because running the python counterargument to my original post, as a stand alone program, gives the same output doesn't mean it accomplishes the same thing. The reason you would't get the position if you interviewed with me is that working on a program until it gives the right output in a single test, then figuring you're done is a tyro nistake.

      Well your code does not exactly instantiate a class while the Python example certainly does. Maybe you want to brush up on class definition and object creation. This post seems to agree with my original argument.

      Now there is this matter of my code just generating the right output by incorrect means. With all do respect, your code was the first offender. I think I was rather clear about not following the oringal Python example but instead your example. How can you call your example an exact replica when it is missing things like the sayHello function and the functions in the original Python example were virtual methods while your example used non-virtual static methods? If you want to pick on me for my code spitting out the right answer then so be it; after all mine was modelled after code that did not run successfully (i.e. your code).

      Hurtful words aside, you hiring?
      And what really matters is not how many non-whitespace characters there are because a person types at pretty much the same speed no matter what language they are doing

      In my opinion, this matters a bit, but not very much.

      Well I am a Paul Graham fan. I did not mean to put great emphasis on this- poor wording I guess. Just suggesting something more meaningful than LOC.
      In fact, people tend to put out the same amount of characters a day regardless of which language they are using- so a language where you type fewer characters can be more productive

      This is about the silliest assertion I've ever heard. Yes, terseness matters, but the real win in Python is not its lexical terseness, but it's syntactic terseness. This comes from having the concept of collections built into the language.

      Well each his own. Glad I could amuse you. Successful realization and utilization can be made by other people.
      There is no productivity difference between typing a left curly brace and hitting the tab key. The main win in this is in reading since reasonable indentation is enforced and visual clutter is reduced.

      Okay, I was not talking about the difference between a tab or curly brace but whatever. Interestingly, I never use TAB when programming in Python. Emacs, and probably any good editor, is smart enough to add a new level of indentation whenever the previous line ends with a colon.

      Enforcing good indentation is certainly makes for programs that are easier to read. This is not secret.
    11. Re:The joke in the example is subtle. by m50d · · Score: 1

      Not quite. The name is made on construction of the class. And I think the class is meant to be useable separately, so having the main() in the same class is a bad idea. It's exaggerated, yes, but I think there's some truth in the image.

      --
      I am trolling
    12. Re:The joke in the example is subtle. by Anonymous Coward · · Score: 0

      Dude, I don't know how serious you are but it does not sound like you would want to work for that guy. Sure it might be easy to usually pull the wool over such an idiots eyes but it is obvious this guy also occasionally close-minded even when he is wrong.

    13. Re:The joke in the example is subtle. by dnoyeb · · Score: 1

      I agree, that was a stupid statement. The time spent writing a program is indeed the time spent thinking. The time typing is neglidgible in comparison.

    14. Re:The joke in the example is subtle. by hey! · · Score: 1

      Didn't mean to to sound so grouchy; sorry.

      I should make it clear I'm a big fan of terseness (and Python), but I think the major advantages are in the maintenance phase, not the initial development phase. Many programmers tend to run on and on, leaving you to wonder not only "what were they thinking?" but "where were they thinking it?"

      I wish I were hiring, but probably not for six months or more. I like people with strong opinions, it makes for higher motivation.

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    15. Re:The joke in the example is subtle. by hey! · · Score: 1

      Well, to contradict myself somewhat (which I am prone to since I have bit of a tendency to shoot from the hip), it is no stupid to say that programmers tend to produce the same number of LOC per day in terse languages and verbose ones, provided this is an emprical fact. It's the confounding of correlation and causation that I disagree with.

      Programmer A uses a traditional language and produces 1000 LOC in a certain period; B uses a scripting language and also produces 1000 LOC over the same period of time, but delivers twice as much functionality..

      Scripting languages are designed to be terse and convenient. To assign programmer B's greater productivity to the language's terseness rather than it's convenience seems a bit much.

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    16. Re:The joke in the example is subtle. by hey! · · Score: 1

      My point is this -- the example may show more about the programming styles of the language users than the language itself. There is no question Python is terser, just not that much terser.

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
  46. Re:Too bad... by Hast · · Score: 2, Insightful

    The same goes for poorly written C++ programs. Sure they may be a bit more responsive at times than a poorly written application in Java or Python but OTOH it has a lot more maintenence issues and the potential severity of the bugs are higher (ie buffer overflow vulnerabilities).

    When I code for fun I seldom do that in C/C++ anymore. At least not I know that the application won't need "that extra juice". What's the point in spending several times the develeopment effort on making it work properly instead of adding polish or just doing new stuff?

  47. Re:Too bad... by Anonymous Coward · · Score: 1, Insightful

    I'm sorry, but the "but it's slow" argument does not hold for most software designed today. Let's please get over it.

    LOL! Fresh out of tech school are we? Not out of college yet? I only wish that I could be there when you discover the "new concept" of efficient and quality programming. Speed counts.

    One day you will have an epiphany. You will realize that it shouldn't require a 3Ghz processor and a gig of RAM to run a browser.

  48. No CPAN == GOOD by Anonymous Coward · · Score: 2, Interesting

    Typical Example Mr. Golfplayer. Found a great little OSS application, needs compiling, uses Perl, running make, opps need to use CPAN, "Oh crap, company firewall blocks FTP", "No problem, I'll download the packages one at a time.", followed by individual downloads, packages added only to find out a package requires another package!

    Bzzzt! Wrong!

    Interdependencies of packages on CPAN are a clusterfuck. All the hack work is paid for by us compilers.

    You tell me to make a backup of CPAN or what? You can't call these packages easily, it's crap work you have to make a offline mirror of CPAN. No. No. No. CPAN is the plague. You customize your Perl env and build and start using non-standard hack libs just because you can and you quote CPAN!

    Python might not have so many libraries OR a so-called package repository but the standard libraries accomplish as much as the fancy CPAN calling Perl code.

    1. Re:No CPAN == GOOD by Anonymous Coward · · Score: 0

      Huh? Never heard of http proxy? Try it next time, works like a charm.

    2. Re:No CPAN == GOOD by Anonymous Coward · · Score: 0

      Oh, that's bad. Any library of stuff is better than no fucking library at all, that's what's so sad.

      And yeah, dependencies are so fucking useless. Hey, everybody! Let's get back using Slackware Linux 1.0! Let's compile everything manually from tarballs and guess the correct order they should be built! (Kind of like when you use CPAN without tools, only you pull stuff from random directories of 10 FTP sites and knife every Makefile to work just right!)

      Python an enterprise programming language my ass...

    3. Re:No CPAN == GOOD by DylanQuixote · · Score: 1

      Solution: Download CPANPLUS, use it to install whatever you need, with dependencies.

      usage:
      # cpanp
      CPAN Terminal> i Module::Name

      Done.

      I have CPANPLUS download from HTTP mirrors because it seems faster, so I really don't see why you'd ever have to directly download something.

  49. Misperceptions about Typing by Anonymous Coward · · Score: 0

    As you say, Java's type system is often worse than managing the typing for yourself (dynamic typing), but that's hardly a reason to move to a dynamically-typed language - a good type system can manage your types better than you can, so if you're going to switch languages over typing, you need to future-proof your investment by moving to something that does it well.

    Surely you don't still believe that garbage collection is inferior to the DIY approach, just because the first mainstream implementations had drawbacks in comparison to C's DIY approach to memory management? So don't make the same mistake with type management.

    1. Re:Misperceptions about Typing by blackhedd · · Score: 1

      Your argument is backwards. You say that first-generation garbage collection was not as good as DIY, therefore first generation DIY-typing is probably not as good as automatic type management.

      Apart from the rhetorical flaw, you're missing the basic point about dynamic typing. "Type-management" is only required by statically-typed languages. In a dynamic language, there's no need to check types at all, because the basic program logic requires proper usage.

      Many traditional programmers like yourself are comforted by the compiler's ability to lexically cross-check your type declarations. Losing that ability is the biggest leap when moving to the dynamic style.

      When you make a type error in a Python program, it shows up as a runtime exception rather than a compile-time error. Most Java programmers have two expectations about this:
      1) It will happen about as often as compile-time errors happen in static programs, viz. constantly;
      2) The runtime type-system errors are annoying and painful to debug.
      However, it turns out that expectation 1 is completely false. This is counterintuitive and surprising, but I have the experience to back it up. Runtime type errors are few and far between. In fact they are generally regressions resulting from changes in program semantics. As for debugging them, they are almost immediately obvious. This is also counterintuitive and surprising but I have the experience to back it up.

      Bottom line: you will not be convinced that dynamic languages are better until after your first few large projects.

    2. Re:Misperceptions about Typing by Anonymous Coward · · Score: 0

      The previous A.C. was probably trying to form an argument in favour of a language based on type inference such as ML, where the compiler/interpreter infers the most general applicable types from apparently typeless code, and gives error messages where your code will fail. The best of both worlds, so to say. I'm still waiting for a modern scripting language with type inference (and proper compilation, dammit!).

    3. Re:Misperceptions about Typing by Anonymous Coward · · Score: 0

      After my first large project .. I switched back to a strongly statically typed language.

    4. Re:Misperceptions about Typing by idlake · · Score: 1

      It will happen about as often as compile-time errors happen in static programs, viz. constantly; [...] However, it turns out that expectation 1 is completely false. This is counterintuitive and surprising, but I have the experience to back it up. Runtime type errors are few and far between. In fact they are generally regressions resulting from changes in program semantics.

      You're arguing a strawman here. The concern people have about dynamic typing is not those dynamic type errors that happen frequently, but those that happen very rarely. You won't see that "regression" before shipping your code unless you actually detect it during testing, but even careful testing is rarely complete. Static type checking, on the other hand, catches many of those errors.

      Many traditional programmers like yourself are comforted by the compiler's ability to lexically cross-check your type declarations. Losing that ability is the biggest leap when moving to the dynamic style.

      Many "traditional programmers" started out on dynamically typed languages and only later moved to statically typed languages, so your belief that people need to make "leaps" to move to a dynamic style simply isn't true.

      The fact that static typing and dynamic typing have existed side-by-side for more than half a century should tell you that both of them have their uses.

      The only real progress in typing has been with languages that offer programmers a choice. Java and C#, for example, offer both static and dynamic typing, and that has been a really useful practical feature of those languages. Dynamic typing features in those languages are somewhat cumbersome to use, but perhaps that's a good thing.

    5. Re:Misperceptions about Typing by Anonymous Coward · · Score: 0

      You read my argument backwards. I'm saying that if automatic memory management is these days accepted as an almost universal win despite the earliest garbage-collectors being more trouble than they were worth, then you can't infer that automatic type manamement will never be the way to go just because primitive type system implementations (like Java's) make you want to do it yourself (i.e. dynamically).

      I've stopped you putting nonsensical words in mouth, but I'm not going to clean up the rest of your mess of misconceptions: you can go and read Type Theory 101 for that. On the positive side, your ignorance of the topic on which you expounded did provide the comic relief of your assumption that I must be a traditional programmer who declares the types of all his variables.

    6. Re:Misperceptions about Typing by Anonymous Coward · · Score: 0

      Haskell provides a far less kludgy facility for using dynamic types in a statically-typed language, but I doubt more than 5% of people have ever needed them. Side-by-side makes less and less sense as static systems get more expressive.

    7. Re:Misperceptions about Typing by Anonymous Coward · · Score: 0

      Expressivity of a type system isn't sufficient, it also needs to be usable by regular programmers. Haskell's type system has become so obscure that most programmers will simply not learn it. Until people figure out how to make expressive type systems usable, they will remain niche players.

      Java and C#'s static type system is dull and limited, but it's fairly easy to learn for programmers, and they can escape to dynamic typing when they need to.

    8. Re:Misperceptions about Typing by blackhedd · · Score: 1

      Static type-management as in Java is the DIY option. Dynamic languages give you the "automatic" type management. That's what's backwards.
      Maybe you meant to say that just because Python's automatic type management is so primitive, that's still not a reason to prefer specifying your own types all over your code, as in Java ;-).
      Ignorance of topic: I've been writing compilers for a living for 15 years now. I wrote my first Java-to-x86 compiler two months after the language was first released. Now tell me what language you prefer for enterprise applications.

    9. Re:Misperceptions about Typing by Anonymous Coward · · Score: 0

      Please get over Java. The reason I brought up Java is because it's type system is as primitive and useless as the earliest garbage collectors that made short-sighted people like you think that automated memory management could never work. Nowadays short-sighted people see Java and assume that automated type-management will never work.

      Don't worry, you've shown more than enough ignorance already. If you want to bluff better next time, go find out what implicit and explicit typing are. Yes, that's what you thought static and dynamic typing were. Well, you were wrong. If you want to actually _know_ better next time, go and find out what static and dynamic typing are.

    10. Re:Misperceptions about Typing by Anonymous Coward · · Score: 0

      I don't really agree with that: Haskell's type system is only difficult if you try to do things you can't do in Java's type system. If you're trying to do equivalent things, I'd say Haskell's system is usually simpler, cleaner and less invasive.

      People had to "escape to dynamic typing" so often in Java that they had to add a horrible tacked-on generics system. Compare that to learning/using the Haskell equivalent!

  50. Python embedded? by SassyDave · · Score: 1

    Would anyone recommend Python in an embedded environment, like say embedded Linux on a Virtex 4 with dual hard-core PPC processors running at 350MHz? Would anything but C/C++ be fast enough for this kind of environment?

    I'm inclined to think that the embedded world is still very much dependent on the old workhorses C and C++, but I could be wrong.

    1. Re:Python embedded? by CapnRob · · Score: 1

      I'm running - admittedly, in a very non-enterprise environment - python on a 200mhz ARM. Seems to work fine.

    2. Re:Python embedded? by Anonymous Coward · · Score: 0

      Python is viable even on machines a lot slower than 350 MHz; we still have one 100 MHz box in our lab.

      I can't recommend Python for a *particular* embedded application without knowing more of the requirements. But, yes,
      I have a LOT of experience using "scripting" languages in embedded situations where only C was thought possible, and high-level languages have worked great for me.

      Reach us at http://phaseit.net/contact.html for details.

  51. they already have by Yonder+Way · · Score: 1

    Ever hear of the Crimson Permanent Assurance?

  52. I'll bite by gr8_phk · · Score: 1
    I was very skeptical of the whole indentation/whitespace thing in Python. I finally decided to learn the language to see what all the hype was about. I'm a C/C++ guy, and now I really really like Python too. Although it's not just the whilespace thing. Some of the language syntax is very compact while still readable, particualrly when working with strings and lists. The native string handling and url lib were fantastic for a (web scraper) test app I wrote, and I didn't even get to the xml library yet. In response to this:

    "I just run it through Emacs' indent-region."

    Why would you want to reformat code every time you check it out? And what about checking it back in? That only work if you're completely taking over a project, or mandating a particular style. Keep in mind that the fact that you're familiar with this issue indicates that there is a problem in your language. Someone who only ever learned python would not be familiar with this "different style" issue at all - it doesn't exist in python.

    "Can anyone explain to me why this is not just as viable as mandating the indentation policy by embedding it in the language's syntax?"

    It's not just a policy. It's an enforced policy - meaning code doesn't work correctly if it's not formatted correctly. That may sound like big restraints to a programmer, but haven't you ever tried to follow someone elses coding style? It's not the end of the world. The biggest arguements I've seen in C are when one guy puts { on a new line and someone else puts it at the end of a conditional or for(){. Or when someone indents 2 spaces for { and then another 2 spaces for the code (I hate that). In python these worst case differences of opinion can not happen because they are arguements over the placement of extra characters that don't exist in python syntax. We all indent the code anyway - in fact python doesn't care how far you indent, just that you do. Therefore, Pythons enfoced indentation style is not IMO objectionable, and you don't need to type the extra characters (and {} each require the shift key). That may seem lazy, but so is an unwillingness to use a defined indentation style.

    Just commit to doing some of the tutorials and writting a simple application with it (or any language) before you pass judgement. That's all I can really say. If you still don't like it after actually using it, at least you'll have a proper feel for what it's like and why people may like it.

    1. Re:I'll bite by Silvertre · · Score: 1

      Or when someone indents 2 spaces for { and then another 2 spaces for the code (I hate that).
      Yeah, my boss does 2 spaces for the { and 1 space for the block. I HATE reading that code. I sometimes wish it was 2/2.

      I wonder though, how widespread is that indenting practice?

    2. Re:I'll bite by vidarh · · Score: 1
      The fact that formatting in C is such a big debating point only serves to underline that the freedom to choose the style to program in MATTERS to people, which is why you see so many people balking at Python over syntax (and over LISP and Scheme as well). You'll notice that all the different camps of people advocating different C styles still use C. If C mandated one of the styles, I'm sure you'd see a lot of C programmers picking other languages. THAT is how important syntax is to people.

      And that is why the Python syntax is a problem.

    3. Re:I'll bite by gr8_phk · · Score: 1
      After thinking about my post, I can now say it clearly:

      Most of the style debate in C is over where to put the {braces}. Python simply eliminates the braces, so there is nothing to debate.

      If you want to leave a blank line where your braces used to go that's fine. If you want to indent a different number of characters that's fine too. Python doesn't care how FAR you indent, just that you do. Given that, braces are wasted characters.

      I haven't seen anyone who does not indent C code (ioccc aside). So just imagine your existing style with all the braces left out. That's the Python way.

  53. Re:Less Time Coding, More Time Debugging/Maintaini by BasilBrush · · Score: 1

    You're not talking about python there. Python is the most readable language I've ever used. I suspect you have't used it.

  54. MOD UP++ by Anonymous Coward · · Score: 0
    I have to agree having learned python after perl and java that python is oddly unfinshed in many ways. To my surprise I quickly got over the whole "whitespace" issue--indeed it really does make for clean looking syntax (although it does create syntax errors in itself it makes finished code easier to read than block delimiters. in the long run that is more important to re-usable code).

  55. Divide and conquer by what+about · · Score: 1, Interesting

    So, instead of Java we could use perl, pyton, php (remember that?) .net and I am sure someone will come up with many more. They all are simple, fast, exciting, new, wonderful... etc.

    I am beginning to think that this is a plot of Microsoft to dilute the only alternative to .net (.net is a clone of java, but of course -SARCASM- much better, faster, newer, more portable etc. -/SARCASM- )

    It was Caesar that used the method to conquer an empire, and it did work.

    1. Re:Divide and conquer by Anonymous Coward · · Score: 0

      You propably meant:
      "Divide et impera" which is Divide and rule.:-)

  56. And now for something completely logical by xigxag · · Score: 1

    "Mind your own business, Mr. Spock. Your mother was a hamster and your father smelt of elderberries!"

    "You don't frighten us, Starfleet pig-dogs!"

    --
    There are two kinds of people: 1) those who start arrays with one and 1) those who start them with zero.
    1. Re:And now for something completely logical by colinrichardday · · Score: 1

      We point our phasers in your general direction!

  57. Awesome! by Arcturax · · Score: 1

    As someone who used to code for a living in python for enterprise, this can only be a good thing. This is one of the easiest languages you can learn, I picked it up in just a week and was more or less productive from that point onward.

    The company I worked for used it for CAD/CAM software, which let code written in one language, python run on five platforms (windows, and a bunch of UNIX platforms). The ability of Python to call C libraries when speed was a must made it the perfect language for our uses. Given you really want speed in the CAD world, python still did the job admirably!

    You still needed the C interfaces, but you could do all the logic and front ends in Python, which really reduced the amount of re-work when porting to new platforms without really sacrificing much speed at all. I'm glad more companies are seeing the use for Python and hopefully many will learn, like my last employer, that Python is good for more than just replacing Perl and shell scripts.

    --

    --Won't that be grand? Computers and the programs will start thinking and the people will stop. - Dr. Walter Gibbs
  58. Python Zealots Are Like Apple Zealots by hameluck · · Score: 0, Flamebait
    The number one complaint about Python is the forced use of whitespace instead of block begin and end delimters.

    When some zealot starts pushing Python that's the first thing that they'll also defend. Much like when some zealot starts pushing Macs and the one button mouse is the first thing they'll defend.

    It doesn't matter if it's "right" or "wrong". Some people just don't like it. There are no absolute truths when it comes to people's preferences.

    It reminds me of a joke I once heard regaing a guy who, after getting hard contact lenses fitted said, "It feels like a toenail is stuck in my eye", to which the optometrist responds, "Don't worry, you'll get used to it." He replied, "If I've got a toenail stuck in my eye I want it out, I don't want to get used to it."

    All I can say is there already are a lot of block delimters already in use in Python, e.g.:
    foo = {
    'a' : [ 1, 2, 3 ],
    'b' : [ 4, 5, 6 ]
    }
    That defines an associate array with a regular array as the value and a string as the key.
    Python's statement's like if still require weird syntaxtic sugar (presumably for parsing):
    if foo == bar:
    print foobar
    else:
    print barfoo
    What's with the colons?

    Instead of alienating people by spouting dogma and telling them their opinion is invalid and incorrect when critiquing Python's choice of how to handle statement block delcarations perhaps just once reflect on why so many people feel this way and just maybe ponder the possibility and wonder to yourself "Why can't there be block delimters or the use of whitespace? Wouldn't that make everyone happy and the world a better place to live?"

    At least in Apple's favour, it may have taken them 20+ years to come around but at least they finally did. Perhaps there's some hope for Python too but maybe we'll have to wait until 2010.
    1. Re:Python Zealots Are Like Apple Zealots by Anonymous Coward · · Score: 0

      You come off as much a zealot as the guys you're complaining about. Differences in surface syntax are completely superficial, and I don't believe a competent programmer should have any trouble switching between any halfway reasonable syntaxes. If you as a programmer spend time agonizing over punctuation, or the lack of it, you are misusing brain cycles that should be directed on far more important abstraction issues.

    2. Re:Python Zealots Are Like Apple Zealots by CatGrep · · Score: 1

      The number one complaint about Python is the forced use of whitespace instead of block begin and end delimters

      This is why a lot of people are choosing Ruby over Python (certainly it was the main reason I chose Ruby over Python 4 years ago - now that I know Ruby better I'm glad I made that choice for other reasons as well).

      It's interesting that we're seeing articles about how Python is taking the enterprise by storm just about the same time that Python usage has probably reached it's peak.

      In the Python vs. Ruby race, I'd put my money on Ruby. Sure, the number of Python users is probably 4 or 5X the number of Ruby users right now, but I suspect that to turn the other way within 2 or 3 years. Why? Well, the whitespace issue is only one reason, but it does make it difficult to use Python as a templating language (as is commonly done in Ruby on Rails rhtml, for example). Ruby is a more flexible language than Python. Ruby is also more feature-rich (continuations, code blocks which make it easy to define your own constructs which look like a natural part of the language)

      Ruby on Rails is generating a lot of excitement and bringing in a lot of new people. It's a great showcase for what is possible in Ruby.

    3. Re:Python Zealots Are Like Apple Zealots by Homburg · · Score: 1

      "it does make it difficult to use Python as a templating language"

      I don't know about that - check out KID, a Python templating engine which is carefully thought out to work with, rather than against, python's syntax (and which has lots of other cool features, too).

      But Ruby does have some interesting features, to be sure.

    4. Re:Python Zealots Are Like Apple Zealots by idlemachine · · Score: 1
      If people are seriously choosing Ruby over Python due to this 'issue' with whitespace, then let me just say that as a Python-user, I certainly don't feel I'm missing out on their contributions to the code-base...

      Well, the whitespace issue is only one reason, but it does make it difficult to use Python as a templating language[...]

      You've made this claim a number of times now and since you're asking someone else to cough up hard date on the comparitive speed of Ruby compared to Python, I'm going to ask you to do the same. Exactly how does the 'whitespace issue' make templating more difficult in Python? (It's certainly never been an issue with any of the templating libs I've tried, such as em & Cheetah)

      Ruby is a more flexible language than Python.

      While I was initially impressed by Ruby, the main reason I ended up focusing on Python was better libraries & better support for introspection.

      In what ways do you find Ruby 'more flexible'?

      In the Python vs. Ruby race, I'd put my money on Ruby.

      In the Rails vs. Python-web-frameworks race, I'd say you're right. Ruby has languished in near obscurity until the Rails framework established a concrete use for it.

      But as for Ruby vs. Python, well, I'm not so confident that I'm representative of the mythical majority to speak for them in saying what will or won't happen over the next few years...

  59. Zope is the windows XP of python web frameworks by jbellis · · Score: 1

    large, monolithic, and inelegant.

    Zope is a reason there are so many python web frameworks today: people try Zope, think, "there has GOT to be a better way" and create a new framework. :)

    1. Re:Zope is the windows XP of python web frameworks by Anonymous Coward · · Score: 0

      Zope is a reason there are so many python web frameworks today: people try Zope, think, "there has GOT to be a better way" and create a new framework.

      Like Zope3?

    2. Re:Zope is the windows XP of python web frameworks by sirReal.83. · · Score: 1

      I must say that Zope is extremely impressive, but what made me dpkg -P it was the fact that I had to use ftp to upload to localhost...

  60. GUI/RAD by samael · · Score: 1

    What's Python like for coding GUI's in?

    And are there any nice IDEs available for it?

    1. Re:GUI/RAD by Klivian · · Score: 1

      >What's Python like for coding GUI's in?
      Absoulutly fantastic:-) Try PyQt.

      >And are there any nice IDEs available for it?
      Oh yes, try eric3
      http://www.die-offenbachs.de/detlev/eric3.html

  61. Which Python? by Rui+del-Negro · · Score: 1

    John Cleese? Eric Idle? Michael Palin? Terry Jones in drag? Or have they decided to drop the 3D CGI and replace all special effects with Gilliam's cutouts?

    1. Re:Which Python? by Anonymous Coward · · Score: 0

      The best python is the Reticulated Python.

  62. Slashdot confirms it by Andy+Dodd · · Score: 1

    Java is dying!

    Sorry, I just couldn't resist.

    On a more serious note - good riddens. Java needs to die a quick and painless death. Unfortunately it'll be a slow and painful (especially for those that are forced to use it) death. Java is the one programming language I've used that I have truly *hated* working with. It's slow, bloated, and has no redeeming qualities to make up for it. It even failed at its goal of "write once, run anywhere" - I don't know how many Windows-only Java applications I've seen, and J2ME is a joke - look at any mobile gaming site and their J2ME games have a different file size for nearly every phone they support.

    Unbelievably, despite Python being a scripting language (admittedly one that can be bytecode-compiled) and Java being bytecode-interpreted, my experience has been that every Python app I've used has been far more responsive and memory efficient than anything written in Java I've used. (Java AIM client and its 256M of memory usage anyone?) Add psyco (JIT compilation for Python, x86-only for now) and it's REALLY fast.

    It's also pretty easy to interface native code to Python when you need the speed, even easier than using SWIG with Perl

    --
    retrorocket.o not found, launch anyway?
    1. Re:Slashdot confirms it by Anonymous Coward · · Score: 0

      On a more serious note - good riddens. Java needs to die a quick and painless death. Unfortunately it'll be a slow and painful (especially for those that are forced to use it) death.

      Actually, it's already dead. It's just waiting for the GC to get around to it.

    2. Re:Slashdot confirms it by Cederic · · Score: 1


      >> It's slow, bloated, and has no redeeming qualities to make up for it. It even failed at its goal of "write once, run anywhere"

      With all respect, there are a lot of very professional programmers proving you wrong daily.

      It's pretty standard practice in the enterprise computing world to
      - develop in java
      - develop on Windows and deploy on Unix

      People wouldn't be developing in java if there were no redeeming features. Perhaps it's not suited to your purposes, but it is very definitely very good at enough things to be useful.

      Its cross platform capability does exist, and is useful, and is used. Just because some programmers fail to use it doesn't mean it isn't possible.

      As for the 256M RAM usage for the Java AIM client: I can write you a C client for AIM that uses 768MB of RAM if you like? Don't judge a language by the code of an individual.

      Personally I don't know Python. I have however recommended it to several people as a language to learn to program with. If they can get a job using it, so much the better; if not, it'll at least give them the grounding they need to learn other language skills that are more employable - such as java.

      ~Cederic

  63. The "Different Style" Issue ... by Anonymous Coward · · Score: 1, Interesting

    Does exist in Python. Guido, last I heard, believed firmly that tabs stops should always be 8 characters apart. Almost every other programmer likes 4 or 3, but some like 2 or even 1. Some have their editors set to use and save tabs, some have their editors set to get rid of all the worthless tab characters. You've got to enforce some kind of standard on a shop of multiple python programmers to make this work at all.

  64. Great... but PLEASE allow 'implicit none'! by Richard+Mills · · Score: 1

    I've had very positive experiences with Python, and I'm glad that it is making its way into lots of large, serious projects. Problem is, though, that as these projects get very large, there HAS to be an option to disable implicit variables, e.g., variables that can be used without first being declared. Try working with an old Fortran 77 code that is full of implicit variable usage, and you'll understand!

    Please, Python dev-team, hear our pleas!

    1. Re:Great... but PLEASE allow 'implicit none'! by beliavsky · · Score: 1

      I use implicit none in all Fortran code, but I don't think that "large, serious projects" in Python should require variable declarations in all cases, even if Python had that feature. An advantage of Python's duck typing is that generic programming is simple. As a trivial example, a function such as

      def twice(x):
      return 2*x

      will work for integers, floats, and Numarray arrays of integers and floats. Requiring x to be declared would needlessly limit the functionality of function 'twice'.

      What I would like in Python is that ability to declare constants, similar to "const" in C++ or "parameter" in Fortran.

      Btw Pyrex is a Python-based language with declarations.

    2. Re:Great... but PLEASE allow 'implicit none'! by Homburg · · Score: 2, Insightful

      Strictly, python doesn't allow variables to be _used_ implicitly, it only allows them to be created on assignment. But I agree that this can be a source of bugs (although in my experience much less frequently than giving variable an implicit value, as PHP - that terribly combination of the worst features of C and Perl - does).

  65. Re:Too bad... by Anonymous Coward · · Score: 1, Insightful

    Once you've fixed the gazillion-th bug caused by dangling pointers or out of bounds access you start to realize that the fast-no-matter-the-cost approach is utter bullocks 95%* of the time (if not more).

    * Number pulled from you know where.

  66. Re:Too bad... by FreeLinux · · Score: 4, Insightful

    What's the point in spending several times the develeopment effort on making it work properly instead of adding polish or just doing new stuff?

    What's the point of making it work properly?!?!? Surely you have mis-spoken here.

    Let's play a game. Let's suppose a bunch of little apps for which speed is not a critical factor for any one of them. As a forinstance, look at all those apps presently running in the system tray. Let's suppose that those apps are written badly or are written in inefficient languages. That shouldn't be too much of a stretch.

    Now, let's try to do something. Whether you are trying to run a realtime application like desktop video conferencing or create a document in a word processor, it doesn't really matter. What ever it is that you try will be a struggle because the system's resources (CPU cycles, memory, swap space) are consumed by all those "noncritical" apps and their inefficiencies. A 1Ghz processor with 1 gig of RAM is no longer adequate? That's ridiculous! And yet, that is where we are at today.

    Everyone seems to feel that their "Ultimate MP3 player" is the only app in the world or at least the only one that will ever be run on a machine. They don't think that speed and size are important. After all, they have a very powerful machine at their disposal with oodles of available resources, right?. They fail to realize that their program, no matter how wonderful, is only one of countless others that are all running at the same time and are required to share the resources. They fail to realize that their app may not be too slow when run by itself but, it becomes too slow when run with everything else.

    Today, the preferred system is 3Ghz, 64bit, with at least 2 gigs of RAM. Why? What's the point of such a powerful system? Speed! That's the point. Speed is important. Code efficiency is important. But, as programmers continue to deny this and produce poorly written and bloated/slow apps or use inefficient languages, the time will come when a 6Ghz processor is not enough. Doesn't that sound stupid?

  67. Crucifiction vs Crucifixion by blackhedd · · Score: 1

    Was that an intentional pun?

    1. Re:Crucifiction vs Crucifixion by Anonymous Coward · · Score: 0

      I don't think even the most dedicated atheist has difficulty in admitting the historical occurance of a peasant carpenter getting brutally snuffed by the Romans.

      Whether or not you consider it deicide is for you to decide.

      Hint: yes.

    2. Re:Crucifiction vs Crucifixion by blackhedd · · Score: 1

      Well roared, Lion!

  68. Python for Series 60 by tungwaiyip · · Score: 1

    Excerpt from http://www.forum.nokia.com/main/0,,034-821,00.html

    Python for Series 60 allows developers to execute Python commands and run Python scripts and applications in devices based on Series 60 Platform.

    Python for Series 60 is capable of running applications that use native resources of Series 60 Platform and Symbian OS. It is well suited to the development of prototypes or for building proof of concept applications with a simple and consistent language. Python for Series 60 is an idea choice for starting to create application for devices based on Series 60 Platform.

  69. I thought Enterprise was cancelled! by olddotter · · Score: 1

    Read the subject line....

  70. Python is killing C#, not Java by Anonymous Coward · · Score: 1, Insightful

    I've done work simultaneously in Java and C# in the last 2 years, and there so similar as to not have any meaningful difference, as far as day to day coding goes. Every coder worth his salt is looking for the next good thing to learn, and for a lot of guys, it boils down to: C#, or something different? Anecdotally, 'something different', i.e. Python, seems to be more attractive. So what I've seen at two large employers in the Bay Area is that people spend a couple days playing with C# , conclude that it's enough like Java that there's no need to invest time in mastering it, and then after playing with Python, they decide Python is the new toy worth spending many evenings and weekends mastering. So I think we'll find in a few years there will be a lot of programmers who have deep Java expertise, and secondarily pretty good Python expertise.

    1. Re:Python is killing C#, not Java by Anonymous Coward · · Score: 0
      One great way to use Python while still being able to easily interoperate with .NET programs and take advantage of the CLR's base class libraries is IronPython, an open-source implementation of Python for the CLI (it works with both Microsoft .NET and Mono).
      It actually turns out to have suprisingly good performance compared to regular Pyhton implementations (see this presentation from PyCon 2004).
      The latest version (released a few days ago) isn't yet linked to from the IronPython website, but can be obtained here.

      DISCLAIMER: I'm not affiliated with the IronPython project, and I haven't yet had the opportunity to make any extensive use of it, but what I've seen so far looks really promising.
  71. Nice IDEs available for it. by Anonymous Coward · · Score: 0

    Builded with the Default build of Python there IS a IDE but kinda ugly...

    As corporate and enterprise-able products and that have support:

    The Kompany makes one called Black Adder...(Never seen it.)
    http://www.thekompany.com/products/blackadder/

    ActiveState makes one called Komodo(pay) which can/is bundled with ActiveState Python(free). It is very nice and a free trial download!
    http://www.activestate.com/Products/Komodo/?_x=1

  72. No Pain by dynamol · · Score: 0

    "Will we finally be able to code for living in a language that's not painful? Exciting times!"" Yeah...I have been doing ti for years...I believe it is called C++. No language is painful once you master it....well except FORTRAN.

  73. Argghhh.. do not use spaces for indentation! by aurelian · · Score: 1
    This is what bugs me about python: too many people will use spaces and I will have to start caring about their opinions. Yes indentation significance is a good thing but ONLY if you use tabs. Repeat the following several times:

    Spaces are for spacing, tabs are for indenting: 1 tab per level of indentation

    Sorry for shouting, but the number of spaces *you* use to represent an indent in *your* editor SHOULD BE IRRELEVANT TO ME! The only reason it ever becomes an issue is when people who don't understand this decide to use spaces to indent their code. And if ever there was a language where this mattered, it's python.

    1. Re:Argghhh.. do not use spaces for indentation! by Anonymous Coward · · Score: 0

      Heretic! The tab character in a unix text file means "move to the next multiple-of-8 column" and nothing else!

    2. Re:Argghhh.. do not use spaces for indentation! by colinrichardday · · Score: 1

      Yes, but Python is cross-platform.

    3. Re:Argghhh.. do not use spaces for indentation! by Berfert · · Score: 1

      You're entering religious war territory here... I think spaces should be used for indentation, and the tab key should tell my editor to move to the correct indentation of the current line. There's a lot of people that agree with you, and a lot of people that agree with me, and a lot of people that have other opinions. I think the only thought that tends to be consitant is that you shouldn't mix tabs and spaces; you should use one OR the other for indenting, but not both.

    4. Re:Argghhh.. do not use spaces for indentation! by aurelian · · Score: 1
      Emacs v. vi is a religious war. So is Python v Perl v Ruby, or BSD v Linux. In a religious war there is no overarching way to decide who is wrong or right.

      Tabs v spaces is different. If we share code that you have written then I am *forced* to accept your system of indentation and your idea about how many spaces constitutes an indent. Why would you want to force me to do that? If we share code that I have written, you can set your editor to display tabs to whatever width you like and we can both be happy!

      It's really that simple. Your preferences for displaying code should not matter to me, and vice versa. There are no good arguments for using spaces for indentation.

    5. Re:Argghhh.. do not use spaces for indentation! by jez9999 · · Score: 1

      Agreed. Why doesn't Python simply make any non-tab character between two statements illegal? That'd make the whole whitespace thing a lot more viable; it's no longer whitespace, it's *definitely* tabs, or it's illegal code.

    6. Re:Argghhh.. do not use spaces for indentation! by aurelian · · Score: 1
      I'd like that! But I suspect the reason has something to do with the fact that Guido van Rossum seems to be confused on the matter - he seems to think that tabs correspond to a certain number of spaces, which is different for different people.

      See for example the python style guide co-authored by him, which actually recommends spaces! I've even seen this used as support for the idea that spaces are better than tabs.

      The fact that the originator of the language doesn't understand this does put me off python just a little.

    7. Re:Argghhh.. do not use spaces for indentation! by Berfert · · Score: 1

      Feel free to argue the case with the thousands upon thousands of people that already argue one way or the other. How about the people that say a full indent is for block levels, and 1.5 indent is for continued lines? There's lots of ways to look at the issue, and lots of people arguing for each way. The only ones that are "wrong", in my opinion, are the ones that believe their way is the only "right" way.

    8. Re:Argghhh.. do not use spaces for indentation! by aurelian · · Score: 1
      Blurghh. Like all the other people who think its some kind of aesthetic disagreement, you continue to ignore my point: your display preferences for indentation should not affect mine.

      When you're writing code you should be thinking about syntax, and using an editor which will take care of the formatting for you. '1.5 indents' has no syntactical meaning - you're talking about 1 indent + some spaces. I can live with the meaningless spaces (which you think makes it look prettier in your editor) if they only occur every now and then and don't screw up my indenting..

    9. Re:Argghhh.. do not use spaces for indentation! by Berfert · · Score: 1

      I'm not ignoring your point, I'm just disagreeing with it. I agree that my choice of indenting should not affect yours. However, I disagree about the choice of "how" that should come to pass. You said "Spaces are for spacing, tabs are for indenting: 1 tab per level of indentation". I merely pointed out that there can be such a thing as 1.5 indentation. Thus, your indentation scheme does not work for everyone. Personally, I'm a big fan of "4 space per indentation level, 8 spaces for continued lines". However, if the code I'm editting doesn't use that scheme, I either hit C-M-\ to reformat it so it does... or just live with what the author has chosen. Perferably, the lead on a given project will decide what indentation scheme to use, and everyone will use that. However, to say that one particular scheme is the best for everyone is naive, imo. Different people like different things. Thats the reason noone has won this particular argument in the past... and many thousands have fought it.

    10. Re:Argghhh.. do not use spaces for indentation! by JurgenThor · · Score: 0

      Oh yeah, good idea. Then we end up with something brain-dead, like 'make'.

      --
      GENERAL PUBLIC SIGNATURE (GPS) Any replies (derivatives) of this post must also use the GPS
    11. Re:Argghhh.. do not use spaces for indentation! by gr8_phk · · Score: 1
      Your editor has adjustable tabs. Some have automatic tools to reformat the code to a given indentation style. I set my editor to substitute spaces for tabs whenever possible - it's the only way I can use different editors and keep my sanity.

      do you use Python? I think the opinions on spacing are less important when braces are not involved, although I still prefer 4.

  74. The trouble with parrots by CoderDevo · · Score: 2, Funny


    Dr. McCoy - - Captain, I wish to register a complaint... Hello? Miss?
    Capt. Kirk - - What do you mean, miss?
    Dr. McCoy - - Sorry Captain, I have a cold. I wish to make a complaint.
    Capt. Kirk - - Not now Bones, we're closing for launch.
    Dr. McCoy - - Never mind that, I wish to make a complaint about this tribble that I purchased not half an hour ago from this very bridge.
    Capt. Kirk - - Oh yes, the Bajoran Blue. What's wrong with it?
    Dr. McCoy - - I'll tell you what's wrong with it. It's dead, Jim, that's what wrong with it.

  75. Toenails by blackhedd · · Score: 1

    "If I've got a toenail stuck in my eye I want it out, I don't want to get used to it."

    Uncontestably true, but it says nothing about having a hard contact in your eye, so it misses the point.

    Whitespace-delimited blocks are not the reason to use Python. Dynamic typing is.

    But even having said that, I've seen many cases where thirty minutes of practice gets rid of the problems people have with the whitespace. The problem is prejudice, not toenails.

    1. Re:Toenails by CatGrep · · Score: 3, Insightful

      Whitespace-delimited blocks are not the reason to use Python. Dynamic typing is.

      Ruby will give you dynamic typing without all of the whitespace issues. Given that the two languages compete in (mostly) the same space, why should I go with Python if I don't like it's whitespace issues?

      I've seen many cases where thirty minutes of practice gets rid of the problems people have with the whitespace.

      But why do I have to adapt to the tool as opposed to the other way around?

      Your reaction is just as the OP predicted.

      The truth is that whitepace-delimited blocks can be a source of difficult-to-find bugs. It also makes it quite difficult to easily copy n paste code from one place to another. Add to this that it makes Python a very poor language for templating (embedding in HTML for example) and you start to understand why Ruby on Rails is doing so well.

    2. Re:Toenails by Dominic_Mazzoni · · Score: 1

      The truth is that whitepace-delimited blocks can be a source of difficult-to-find bugs.

      So can non-whitespace-delimited blocks. Haven't you ever accidentally lost a } in C in the middle of a complicated function and spent a while searching for it, because the compiler points you to a completely different line with its error message?

      It also makes it quite difficult to easily copy n paste code from one place to another.

      Not if you use a smart editor that lets you select a block of code and increase or decrease its indentation.

    3. Re:Toenails by Ian+Bicking · · Score: 3, Insightful
      Ruby is a fine language, and if Python didn't exist I'd probably be using it. But I think Python has some advantages. Off the top of my head:
      1. Older
      2. More mature: used by a wider variety of people for a wider variety of tasks, community process more developed
      3. Unicode
      4. Syntactically simpler; less punctuation
      5. There Should Only Be One (Best) Way To Do It (not always succeding -- but at least we try)
      6. Less opportunity to globally effect the language/process -- e.g., you can't change the behavior of strings throughout the system
      7. Larger community
      8. More libraries and software
      9. Better OS support -- standard on most Linuxes, Mac OS X
      10. Some corporate support (e.g., IronPython); EU funding
      11. Distributing Python apps fairly easy. Large-scale distributions have been successful (e.g., BitTorrent, iPodder)
      12. OS-level threading (I don't believe Ruby has this, though I think they are trying to add it)
      Well, those are the ones I can think of now.
    4. Re:Toenails by mzipay · · Score: 1

      The truth is that whitepace-delimited blocks can be a source of difficult-to-find bugs.

      Actually, the truth is that any programmer with any experience in any language has encountered difficult-to-find bugs related to WHATEVER a particular language uses as a delimiter.

      For the record, I've been programming in Python for nearly 10 years, and have never had a problem with whitespace-delimited blocks, even as I switch between coding C/Java and coding Python (on a near-daily basis). And I don't use any fancy IDE to assist me, either - strictly vi.
      It also makes it quite difficult to easily copy n paste code from one place to another.

      Huh? The layout of any block of text (whether code, poetry, prose, or anything else) is entirely irrelevant to the process of copying it and then pasting it. If your editor has some funky auto-indent features turned on, I could see how you might be *confused* about where the "difficulty" lies, but white-space delimited code blocks are not inherently difficult to copy/paste.

  76. Huge monster python by Peale · · Score: 1

    Anyone else read the headline and think of that, hiding in the ship, eating the entire crew one by one?

  77. Wait a second... by maloi · · Score: 1

    Python isn't painful?

  78. dynamic typing verus intentional typing by goombah99 · · Score: 1
    One thing that programming in python did was to greatly increase my appreciation of perl. Perl uses all these funny prefix symbols like $,@, &, and % on its variables and objects. Now I appreciate this as a much more powerful syntax than dynamic typing.

    python is said to be strongly dynamicly typed. Sort of the worst of both really. The inconvenience of strong typing with the inabilty to syntax check caused by dynamic typing. this means run time errors out the wazoo.

    Intentional typing is what perl does. The prefixes tell the compiler/interpreter what kind of thing to expect but not the type. @ means its an array but never mind the type of the content. $ means its a scalar primitive or scalar reference.

    the result is the compiler can find syntax errors easily and its hard to so something you did not mean. For example, in python both of the follwoing compile:

    A = d.lstrip()
    A = d.lstrip
    in the latter cas A becomes a function reference and in the former it becomes a string with the spaces removed from d.

    Gaa! that's a syntax error waiting to bite, but python cant detect it since both are legal syntax.

    --
    Some drink at the fountain of knowledge. Others just gargle.
    1. Re:dynamic typing verus intentional typing by mrroach · · Score: 1

      That's a pretty weak argument. You can make logic errors that go uncaught by the compiler in any language. If this particular type of error is really the best argument you can find, then you are reaching.

      -Mark

    2. Re:dynamic typing verus intentional typing by Anonymous Coward · · Score: 0

      the point was in praise of perl not so much denigrating python. That is those perl suffixes actually do a lot more than I had previously appreciated in allowing syntax error checking at compiletime.

  79. Python still has severe limits by Cajal · · Score: 2, Interesting

    I'm a big fan of Python. I used it almost exclusively before taking my current job. But let's be honest, Python and Java just aren't intended for the same type of applications.

    Python's standard library just doesn't have the breadth of Java's. For small apps, the CPython VM is lighter than Sun's JVM, but CPython's VM is lacking several capabilities that I'd consider pretty essential -- chief among them is the ability to return unused memory back to the OS. And for many tasks, CPython is still effectively single-threaded due to its global interpreter lock. Java has never suffered from either of these problems. These aren't trivial issues or the result of nitpicking -- they're rather severe limits (which make me seriously question the suitably of Python for enterprise apps, eg. Zope). Of course, once CPython does get decent threading, it's likely that it's GC subsystem will need to be totally rewritten. I apologize if it sounds like I'm beating up on Python. That's not my intent here. I love Python, and I only wish I could stop more people from using Perl :)

    In fairness, it does look like the Python community is trying to address some of these problems. I just read a paper presented last week at PyCon 2005 on CPython's memory management. The author is developing some patches to let CPython return unused memory to the OS for most object types (except for Number, List and Dictionary). The memory manager still can't defragment its heap, so this isn't a perfect solution. As of a few weeks ago it looks like these patches haven't yet been accepted.

    1. Re:Python still has severe limits by DylanQuixote · · Score: 2, Insightful

      I've always be told that in C, free() doesn't (usually) return the memory to the operating system.
      The memory is only available to other programs after the program exits.

      As a result of this, most daemons will re-exec themselves to free up memory for the rest of the system.

      At least, that's what I've always heard. Maybe newer versions of the linux kernel are much smarter...

  80. Sigh! I so agree with you, but... by blackhedd · · Score: 1

    I once spent six months of my life trying to write a production-quality compiler for SML/NJ. I concluded that it couldn't be done. And sure enough, functional languages have not had a mainstream impact on enterprise computing.

    I would contend that the static typing embedded in Java/C++ imposes an exogenous constraint on programming methodology that does not directly contribute to quality (defined as correctness + maintainability + large-team support).

    I suspect that the same is true for type-inference engines. "Duck-typing," on the other hand, relies on the shocking intuition that proper typing is in fact almost automatic in a properly thought-out program.

    In other words, the fact that the compiler/interpreter checks your types doesn't actually make your programs any better. This is the non-obvious insight that explains why Python and Ruby seem to be "magically" better to their proponents.

    1. Re:Sigh! I so agree with you, but... by Anonymous Coward · · Score: 0

      I'd love to hear more detail on your problems writing the SML/NJ compiler (I assume they weren't just the usual mutability vs. typing conflicts).

      Proper typing is almost automatic in a properly thought-out program under any typing regime. The interesting cases are incorrect programs, programs with complex typing requirements, and documentation (for future maintenance).

      Where static types help is to give you a language in which to think about the tricky parts, a built-in source of documentation, and for the compiler to give you meaningful error messages (though sometimes dynamic means you can "see" what goes wrong).

      So static type-checking _can_ make your programs better in two ways: It makes them better-documented (because you have a automatic tools to explain the types to you), and it catches the corner cases sometimes you forget when you type dynamically. The first is subtle and the second is rare, but both are real benefits. And if the static language of types lets you think more easily about them, your program might be simpler, or design might be quicker and less error-prone.

      But if you use a primitive type systems like those of Java or C++ (which have both been improved by generics, but the tediousness of the implementations and the legacy of libraries mean that they are rarely used properly) then you will often find drawbacks in expressivity that negate these benefits, and often leave you having to jump through hoops in order to emulate dynamic typing and get that expressivity back.

  81. Better Python-GIS example by Bazman · · Score: 1

    There's a much better example of the use of python in a GIS: OpenEV - its open-source, cross-platform, and has an open python API for writing extensions, including, using PyGTK, graphical dialogs and menus.

    Its not as 'enterprise' as anything from ESRI is, but as an open platform for building custom solutions onto basic GIS functionality, I've not found anything better.

    1. Re:Better Python-GIS example by Bazman · · Score: 2, Informative
  82. look beyond whitespace to truely appreciate Python by tungwaiyip · · Score: 1

    It will be a true pretty for many good programmer to overlook Python just because they the feel turn off by the whitespace syntax.

    To appreciate the power of Python one should look beyond this trivial issue. How do you feel if your 50 lines Java program can be implemented in 10 lines Python code? What about the productivity gain you can archieve by using such agile and dynamic language? Once you used Python's high level data structure like list and map, Java's collection feel like a drag.

    Whitespace is such a trivial issue, it never enter my consciousness after I used the language for 5 minutes. Turn your focus on truely significant aspect of a language, not this minor syntactic issue. Python has many more unconventional design that may shock you when you look deeper into it. And these unconventional ideas are what make Python a break through rather than yet another language. (Think XP)

  83. Does Python have "goto" yet? by Glomek · · Score: 1

    Without goto a language is crippled. It is fairly easy to translate a Knuth algorithm into a language that has goto (C, BASIC, Perl, Common Lisp, Scheme (tail calls)). Translating into a language without goto sometimes requires enough changes that it isn't obviously the same algorithm.

    1. Re:Does Python have "goto" yet? by Anonymous Coward · · Score: 0
  84. Python and Java? by smack.addict · · Score: 1

    If you are deciding between Python and Java, you obviously don't understand the question.

  85. and now for something completely different by saboola · · Score: 1

    I read the headline and thought that is the one thing they needed to get Enterprise past season five, the Monty Python boys reprising the roles of the various enterprise crew. Nobody expects a federation inquisition!

  86. Kill the GIL (Global Interpreter Lock) by hagbard5235 · · Score: 4, Interesting

    I love python. It's by far my prefered language for development, but it has one major impediment that makes it very hard to take seriously in many rolls in an enterprise: the GIL (global interpreter lock).

    You see Python has quite good support for threads, but there are a number of operations in the interpreter that are hacked into being thread safe by providing a global lock on the whole interpreter. One of them is reference counts on objects. So everytime I do an assignment, I have to queue for the GIL. This effectively means that I only really run one thread at a time, even if I have multiple CPUs in the box (or soon, multiple cores).

    As more and more applications start shifting to multicpu (or multicore boxes) this problem becomes a much more noticable issue.

    Kill the GIL.

    1. Re:Kill the GIL (Global Interpreter Lock) by Anonymous Coward · · Score: 0

      You see Python has quite good support for threads, but there are a number of operations in the interpreter that are hacked into being thread safe by providing a global lock on the whole interpreter. One of them is reference counts on objects. So everytime I do an assignment, I have to queue for the GIL. This effectively means that I only really run one thread at a time, even if I have multiple CPUs in the box (or soon, multiple cores).

      The only time I've ever used threads in Python were in an instance where I needed to query two servers and each would take a second or two to respond, so I didn't want to double the wait for the user by serializing the requests. Instead I had the main thread spin off two other threads and waited for them to come back to put the answer together.

      Using threads to crunch data? Python's glue code, dude. If you're worried about Python effectively utilizing multiple CPUs, you're taking too much work at too high a level.

    2. Re:Kill the GIL (Global Interpreter Lock) by Sloppy · · Score: 1
      True, but sometimes you can split a problem into multiple processes instead of threads.

      I'd like to see more implementations of the Python language, so there would be competition. But not enogh to get off my ass and do it myself. ;-)

      --
      As copyright owner of this comment, I authorize everyone to defeat any technological measure which limits access to it.
    3. Re:Kill the GIL (Global Interpreter Lock) by Ian+Bicking · · Score: 1

      Someone tried getting rid of the GIL several years ago, and CPython ran about 2x slower. That said, some implementations -- like Jython and IronPython -- don't have the GIL. So, it's possible. But hurting everyone's performance for the negligable benefit of multi-processor scalability (which isn't the same as any actual performance requirement) is pretty silly. I'd much, much, much rather see better multi-process capabilities in Python. That Java leans so heavily on threads doesn't mean Python has to.

  87. Clarification about ESR by blackhedd · · Score: 1

    Re-read my post, I was unclear about Eric. He initially resisted Python because of distaste for the white-space handling. However, he tried the language and got past the issue, and now is a Python devotee. My point is that everyone who "hates Python" because of the whitespace issue should spend the time needed to give it a fair trial. Thanks to michael00_98 for taking me to task over this.

    1. Re:Clarification about ESR by Anonymous Coward · · Score: 0

      The same thing can be said about Lisp and its parenthesis.

  88. Performance: python v java in the enterprise by brunos · · Score: 1, Insightful

    You are right: there is no way that you can use python for any task that requires even the slightest amount of performance. Realistically a zope / plone server can support 10 concurrent users (with write access). With PHP I aim at supporting 100+ concurrent users per server, and with java 1000. For me these technologies are for totally different uses, and I use the 3 of them:
    python/zope/plone - intranets
    php/perl - "medium" commercial apps
    java - "Enterprise" stuff (3+ developers)
    For each project the right technology: I like all of them!

  89. Re:Your 5 cents?Heres my 2 cents. CPAN == crap. by Anonymous Coward · · Score: 0

    lol... if you can't ftp, you can just grab files from the cpan website.
    it's funny you didn't think of that. quite telling actually.
    in fact, if you were at all competent, you could whip up a 10-liner script to do that...
    but oh well, guess you better use python, the language for those who can't think out of the box...

  90. Re:Too bad... by Mr.Zong · · Score: 1

    "I'm sorry, but the "but it's slow" argument does not hold for most software designed today. Let's please get over it. " Agreed. Please cavemen, go bang rocks toghther or something. The rest of us are sick of reinventing the wheel over and over again. It was fun 15 years ago writing 20k lines for a windows form, but ya know what? Maybe it's time for you learn someting new.

  91. LOL! by blackhedd · · Score: 1

    I should not respond to your post because I happen to be a Rubyist rather than a Python-ist! However, the key point is that dynamic typing is the benefit which enterprise practitioners need to focus on, and this is true for both Python and Ruby.
    Python is a somewhat older language than Ruby (~15 years vs ~12 years) and is a little creakier syntactically. But that is a pure matter of taste. Both Guido and Matz have said as much on many occasions.
    The whitespace issue is one of those religious things that give zealots something to fight about. But it's important to mention in a discussion about "Python in the Enterprise" because it's a (perceived) barrier to adoption.
    Ruby has different barriers to adoption (at least in America and Europe), such as the lack of comprehensive documentation, a defect that is being rapidly addressed through the efforts of Gavin Sinclair and many others.

  92. Do yourself a bigger favour. by Anonymous Coward · · Score: 0

    Ignore this terrible advice. Zope is so horribly slow that it is simply not worth trying to use. You absolutely must run a caching proxy in front of zope to make it usable, and that only helps with pages that are the same for each visitor.

    Zope's documentation is terrible, and trying to do anything above and beyond "ordinary" things becomes a nightmare. You will be more productive using apache + PHP than you will with zope, and that's just sad. If you want to use python, go for it, there's web frameworks for python out there. But stay the hell away from zope.

  93. Re:Too bad... by ArbitraryConstant · · Score: 3, Insightful

    ""Processors are cheap." and "Disk space is cheap." are horrendous excuses for bad programming. If you have used these expressions to justify your application, you are a bad programmer!"

    Okay, I'm going to refute this is two stages because you're wrong in two ways.

    First, it's not a matter of "processors are cheap". It's "processors are cheap compared to programmers, sometimes". If they're paying for months of your time, most of the time it's way cheaper for them to get a faster computer than have you write the thing in a language that will take longer. That is of course dependant on the number of computers it will run on and the performance requirements of the project.

    Second, Java and Python are not necessarily slow. In the case of Java, it's usually a matter of keeping heap allocations to a minimum. In the case of Python, it's usually a matter of spending as much time as possible in a C library (even if that means you have to write the C library).

    Doing that will usually get you within a factor of two of the performance of C.

    --
    I rarely criticize things I don't care about.
  94. Re:So learn how to program. by Anonymous Coward · · Score: 0

    Sadly you can't just flip a switch and never make a mistake again, nor can you flip such a switch in other people.

  95. Available libraries by quantum+bit · · Score: 2, Insightful

    I really like Python. It's an incredibly powerful language -- what other languages give you the power to redefine what "is" means? For example, you can override the '.' operator (and getattr) and create whole sets of virtual objects that don't really exist. Things like object proxies for RPC or external resources like Zope become possible.

    Its main two faults in my mind are:

    1. Speed (but this is being worked on, see the Parrot JIT compiler)
    2. Memory usage. wxPython especially is an excellent toolkit but a memory HOG.

    As far as Java goes, I don't particularly like Java all that much, but one area where it has a definite advantage over Python at the moment is libraries. Not just the standard library, but what add-on libraries are available. Python has a lot, but Java has pretty much everything and the kitchen sink.

    For example, I recently worked on a project that needed to display and manipulate SVG graphics. The two requirements are that it be cross-platform, and be done quickly (in just a couple weeks). I originally wanted to use Python but was unable to find a cross-platform SVG rendering library for Python. I came across the Apache Batik toolkit for Java and found that it was exactly what I needed.

    Batik is pretty sweet -- you get a swing component that you can plop into an app in about 10 lines of code and boom -- you have one of the most compliant SVG renderers that I've seen to date. Plus it even gives you a DOM interface that will update the graphical view in real-time. As much as I dislike Java in general (even more bloated than Python :), the third-party libraries certainly made this project a breeze.

    1. Re:Available libraries by mrroach · · Score: 1

      It sounds like you found a good solution, but i thought I'd toss this in: librsvg + ctypes seems like a quick and easy way to do it. Ctypes is the equivalent of .net's P/Invoke for Python. If you have ever wanted to access a particular library from python but been put off by the amount of work necessary to write a module in c, try ctypes. Here's a librsvg example pulled off the web:

      >>> from ctypes import *
      >>> l=CDLL(".\\librsvg.dll")
      >>> g=CDLL(".\\libgobject-2.0-0.dll")
      >>> g.g_type_init()
      14869872
      >>> error=""
      >>> pb=l.rsvg_pixbuf_from_file("folder.svg",error)
      >>> d=CDLL(".\\libgdk_pixbuf-2.0-0.dll")
      >>> d.gdk_pixbuf_save(pb,"out.png","png",error,None)

      (from http://sourceforge.net/mailarchive/forum.php?threa d_id=6547497&forum_id=12476)

      -Mark

  96. Received wisdom by blackhedd · · Score: 1

    >>> Very bad, it really increases developing times since an error which could simply be signalled at compiling time is, instead, found only when executing the wrong line.
    >>> The value of strictly typed languages is in compile time type checking. It's good to have languages that are not type checked, and it's good to have languages that are.

    These two statements encapsulate the received wisdom on the static-vs-dynamic issue. It will take several years to decide the issue. Compile-time checking is indeed valuable in its own way. However, it just may be that the problems solved by compile-time checking are not actually the problems that make programming-in-the-large difficult to do. Please re-read that sentence a couple of times. This is the subtle and far-from-obvious intuition which must be tested and proved or disproved over the next several years.

    1. Re:Received wisdom by Daniel · · Score: 1

      These two statements encapsulate the received wisdom on the static-vs-dynamic issue. It will take several years to decide the issue.

      You say it as if this is a new issue. Have you ever heard of Lisp?

      Daniel

      --
      Hurry up and jump on the individualist bandwagon!
    2. Re:Received wisdom by blackhedd · · Score: 1

      I sure have.
      But remember the OP: "Python moves into the Enterprise."
      After 43 years, Lisp still isn't close ;-)

    3. Re:Received wisdom by Daniel · · Score: 2, Informative
      That's true, but regardless, this isn't a new issue. I also doubt that it has as much importance as some people think -- I hate writing large programs in dynamically typed languages, but I nonetheless find myself doing a lot of coding in them because of the other features that few statically-typed languages support, like (in rough order of importance):

      • Reliable, portable, free implementations
      • Automatic memory management
      • Large standard and third-party code libraries
      • First-class functions
      • Built-in collection types (growable arrays and dictionaries)
      • Sensible module handling
      • Streamlined syntax
      • Macros


      Most statically typed languages miss out on one or more of these, and all of them have a much more dramatic impact on how quickly I can get anything done in the language than the lack of static typing does -- static typing doesn't get really useful until you have a big interconnected system (and of course the above properties help keep the size of your own program down by eliminating lots of).

      I may spend a lot of time cursing at the lack of static typing, but the fact is that the inconvenience of missing the above features is enough to keep me using Python et al. The most annoying thing is that none of them are particularly tied to dynamic typing, except in the sense that it's simpler to implement a dynamically typed language, because there's a lot of theory involved in type systems (especially if you want to do any sort of inference).

      Daniel
      --
      Hurry up and jump on the individualist bandwagon!
    4. Re:Received wisdom by blackhedd · · Score: 1

      So conceivably some successor to Java could have all the nice features you currently look to Python for. In that case, would you ditch Python to get the static typing?

      In my heart of hearts I'm undecided whether large systems (10 million+ lines of code, hundreds of programmers, decades of lifecycle) are possible in Python/Ruby, because of the lack of implied interface contracts that comes with dynamic typing.

      But I like your insight that dynamic programs may not ever need to get that big because the expressiveness of the languages makes it unecessary!

      This would be a nice question to do a thesis on.

    5. Re:Received wisdom by Daniel · · Score: 1

      Well, so long as it looked nothing whatsoever like Java -- which I guess would be the case if it met all my criteria -- yes ;-). I really like a lot of things about the basic Python syntax, aside from the stuff that makes even a grafted-on static typer impossible (like poking around in the local variable bindings at runtime, for instance); it strikes (IMO) a good balance between being concise and convenient to use while still being clear and unambiguous.

      I should admit that the largest Python program I've written so far is about 6k lines, but even there I've run into bugs that would have been caught by a static type system. At that level it's just a nuisance, but my intuition is that it would get worse as the complexity of the code got larger.

      Daniel

      --
      Hurry up and jump on the individualist bandwagon!
    6. Re:Received wisdom by Anonymous Coward · · Score: 0

      You might want to have a look at scala (scala.epfl.ch), a language in which programming becomes a joy, especially for its type inference, which means that many times, you don't need to declare the type:

      > Reliable, portable, free implementations

      free, yes, portable, yes (just needs a JVM), reliable - well, the language is young

      > Automatic memory management

      check

      > Large standard and third-party code libraries

      check (you can use all of java)

      > First-class functions

      check

      > Built-in collection types (growable arrays and dictionaries)

      check

      > Sensible module handling

      check, I guess - what do mean exactly?

      > Streamlined syntax

      I like the syntax very much, thanks to type inference you don't have to type much

      > Macros

      Nope, but why do you need them?

    7. Re:Received wisdom by the+eric+conspiracy · · Score: 1

      I've run into bugs that would have been caught by a static type system

      The experience with Java is that static type resolution is very important in reducing run time errors - so much so that it was the primary reason for introduction of generics into Java. The basic problem I have with dynamically typed languages is that run-time errors are far more costly to test for, catch and debug than compile time errors.

  97. Three Python Jobs by TheSync · · Score: 1

    Thee Python jobs can be found here...

  98. Re:Too bad... by Anonymous Coward · · Score: 3, Informative

    I'm sorry, but the "but it's slow" argument does not hold for most software designed today.

    What planet are you from? I do a lot of work at oil companies and utilities, and they have tons of slow software that causes them to hemorrhage man-hours at an insane rate. I'm talking about the big name companies spending tens of millions of dollars per year on bloated applications that take 30-60 seconds just to start up and take just as long to perform many of their routine functions. People often use these various functions throughout the day, running them hundreds of times. This amounts to several hours per day of users twiddling their thumbs waiting for slow software.

    Very often, there are only one or two vendors supplying some niche market such as geological interpretation or pipeline facility management. So if you can write an application that takes half as long to perform certain commonly used functions, you've just saved your customer hundreds of thousands of dollars per year in lost productivity, and they will pay you for that.

    There are numerous areas where performance does matter. It's not always the most important consideration, but it's certainly not irrelevant.

  99. Re:Your 5 cents?Heres my 2 cents. CPAN == crap. by Anonymous Coward · · Score: 0

    YOU are the one smoking crack! If you search the Ruby, Python, Tcl (and any other dynamic language) site and you find that they want a CPAN type central repository. CPAN is the MAIN reason I continue to use Perl. I use Tcl as a secondary language because adding libraries is brain dead easy,

  100. You == idiot by Anonymous Coward · · Score: 0
    You customize your Perl env and build and start using non-standard hack libs just because you can

    which is precisely the idea, barring your utterly fallacious argument that the modules are "crap" (which ones? how so?).

    I don't want my devkit to be a 90MB download, I would rather call packages upon request to my system as I need them, outside of the sensible core perl ships.

  101. Re:Too bad... by jaydonnell · · Score: 2, Insightful

    "A 1Ghz processor with 1 gig of RAM is no longer adequate? That's ridiculous! And yet, that is where we are at today."

    1 gig of ram is no longer adequate??? I don't know what "noncritical" apps you use, but I have a AMD 2200 with 512 of ram. I run both XP and Suse on it and I very rarely use up the ram or cpu and I run lot's of python apps. I program python and php for a living.

  102. Re:Too bad... by QuantumFTL · · Score: 3, Insightful

    Today, the preferred system is 3Ghz, 64bit, with at least 2 gigs of RAM. Why? What's the point of such a powerful system? Speed! That's the point. Speed is important. Code efficiency is important. But, as programmers continue to deny this and produce poorly written and bloated/slow apps or use inefficient languages, the time will come when a 6Ghz processor is not enough. Doesn't that sound stupid?

    If there was money to be made by making that WeatherThing or UltimateMP3 player fast and efficient - companies would do that. There's plenty of programmers out there capable of writing in or learning more low level languages - of optimizing each loop or branch. The problem is that people are not willing to pay all of the extra associated with the development and testing of software written with risky optimizations (optimizations tend to complicate and obfuscate code, reduce abstraction, etc) in unsafe languages.

    The truth is the consumer would rather spend an extra $100 to get enough RAM then spend $10 per program on their PC (that adds up faster) for the programmers to program it "correctly." It's not economically efficient, at least not in the eyes of the consumers.

    Why do you think so many kitchen appliances last only a year or two nowaways? Or current VCRs which almost qualify as "disposable." People are rarely willing to pay extra when they think the low cost option is "good enough." In some ways this is what killed the Mac - it was better according to many metrics, but PCs were "good enough" for the average consumer, and the price difference wasn't justifyable.

    A computer is a tool to get work done, nothing more. If people valued security, reliability, and efficiency enough, most software would be secure, reliable and efficeint. But people value features and low price, so that's what the market gives them.

    Look on the bright side - at least compilers are getting better.

  103. Re:Too bad... by Anonymous Coward · · Score: 0

    What's the point in spending several times the develeopment effort on making it work properly instead of adding polish or just doing new stuff?

    What's the point of making it work properly?!?!? Surely you have mis-spoken here.

    ---------
    He meant that if you program in one language, you *have* to spend extra development time just to get it to work, but if you use the other one you can spend time doing other spiffy stuff.

  104. Re:Too bad... by WaterBreath · · Score: 1

    "What's the point in spending several times the develeopment effort on making it work properly instead of adding polish or just doing new stuff?"

    What's the point of making it work properly?!?!? Surely you have mis-spoken here.


    No, I'm fairly certain that you misunderstood. You focused on completely the wrong part of the sentence and totally missed the point. The emphasis was on the "several times the development effort" part. The implication was that in languages such as Python, it is easier to make things that work properly, so it takes less time to get to that point. Which means more time can be spent on streamlining, adding useful extension features, etc.

  105. Half the time of C# or Java? by jonadab · · Score: 1

    # Speakers told of experiments and used anecdotes to explain that programmers
    # who use Python finish jobs in no more than half the time required by those
    # coding in more conventional languages

    The "more conventional languages" it's talking about are C# or Java, mainly.
    (It also mentions XML and SQL, but you don't use Python instead of those.)

    I'm trying to figure out how doing anything in a VHLL such as Python could take anywhere *near* half as long as in C# or Java. As a Perl programmer, I know that if I can't complete, test, debug, and deploy in an eight-hour shift what would take a C# programmer a month, then there's something wrong with my understanding of the problem. I would not expect Python development to be quite as fast as Perl, since it's a bit stricter about certain things, but nevertheless, I would have thought it would be a lot closer to Perl than to Java or C#. It *is* a VHLL, after all, right?

    Are they just being really conservative with this claim, or is Python develpment really that slow?

    --
    Cut that out, or I will ship you to Norilsk in a box.
    1. Re:Half the time of C# or Java? by wk633 · · Score: 1

      I've worked a lot in Perl and enough in C# to know that your 1:21.6 ratio is more than just Perl vs. C#. Maybe you're a guru Perl coder and they're C# noobs? Maybe your problem domaim is lexical analysis?

    2. Re:Half the time of C# or Java? by Liquidrage · · Score: 1

      Please, give one example of something you *could* do in an 8 hour shift it would take a C#/Java developer a month to do.

      I don't think you could name *anything*, let alone *everything* as you claim.

      But please, bring forth the specific examples and actually support your claim.

      I don't even believe by conventional programming languages they meant Java/C#. More likely they meant C++ without letting people use their own libraries they normally tote around with them. Now, that's just speculation on my part as to what they meant, but I just don't believe huge claims on face value. Just because it's a claim for a *friendly* item, doesn't mean these sweeping claims are any more valid that the Gartner crap that gets slammed here whenever it's released.

    3. Re:Half the time of C# or Java? by jonadab · · Score: 1

      > Please, give one example of something you *could* do in an 8 hour shift
      > it would take a C#/Java developer a month to do.

      One example: implement a web-based database for tracking the Friends of the Library, with authentication by IP address and by username/password, that displays all the friends in a table, sortable by any field, and allows easy entering of new Friends, tracking existing friends, editing their information, and searching based on name, or based on things such as willingness to be involved in the book sale. Took me about four hours to get the basics working, and three or four more for debugging and tweaking the layout.

      Granted, this example hits right smack in the middle of Perl's problem domain, but OTOH, so does almost everything I do.

      And yes, a month might be a little generous; maybe I've just seen some pretty slow Java and C# programmers. Still, a ratio of 2:1 just seems really wrong to me; it takes significantly longer than that for a Java or C# programmer to wait for the compiler every time he changes anything, and nevermind about other time-saving Perl features such as the CPAN and general language goodness. I had assumed Python would be closer to Perl in this regard than to "traditional languages", which is usually secret code for "languages that are painfully hard to get anything done in".

      --
      Cut that out, or I will ship you to Norilsk in a box.
    4. Re:Half the time of C# or Java? by jonadab · · Score: 1

      > I've worked a lot in Perl and enough in C# to know that your 1:21.6 ratio
      > is more than just Perl vs. C#. Maybe you're a guru Perl coder and they're
      > C# noobs?

      Okay, I'm pretty solidly conversant in Perl, but "guru" conjures up images of people like Ovid, and I'm nowhere *near* that category of competency. In fact, those people scare me just a little. On Larry Wall's "seven levels", I guess I'm a Perl Adept (though, I don't even meet all the criteria for that), which is two fairly significant levels below Guru (and Guru is not the top of the scale; there's Wizard above that).

      > Maybe your problem domaim is lexical analysis?

      Not per se, although granted, there is a lot of text processing in what I do. But then, there's a lot of text processing to be done in the world; it's a very common thing.

      I will admit that I don't do GUI work in Perl (unless you count web-based frontends as GUI, which is dubious), because the available GUI-oriented modules are almost as painful to work with as the C equivalents. That's one of the things I'm hoping gets fixed in Perl6, though I fear we may have to wait longer than 6.0.

      --
      Cut that out, or I will ship you to Norilsk in a box.
    5. Re:Half the time of C# or Java? by jonadab · · Score: 1

      I also just realized the irony of your referring to C# noobs. Pretty much *every* C# programmer at this point is a C# noob, because the language is just not that old yet. (Java, however, is not hampered by this, and of course the C# noobs usually have prior C++ experience.)

      --
      Cut that out, or I will ship you to Norilsk in a box.
    6. Re:Half the time of C# or Java? by jonadab · · Score: 1

      > I don't even believe by conventional programming languages they meant Java/C#.

      RTFA. They list what languages they are talking about in the previous paragraph.

      --
      Cut that out, or I will ship you to Norilsk in a box.
    7. Re:Half the time of C# or Java? by wk633 · · Score: 1

      and of course the C# noobs usually have prior C++ experience

      Unless they're VB hacks who want to develop their 7331 skilz :-)

      I was thinking about this more, and certainly Perl has a larger library of pre-written modules to draw on.

    8. Re:Half the time of C# or Java? by Liquidrage · · Score: 1

      Seems to me those requirements are rather trivial and wouldn't take much time at all. Test, analysis, etc.. are not really constraints of the language (testing can be) as much as methodology and your implementation of it. You're talking about rather trivial tasks. Display data. Update data. Authenticate. Things .NET/Java do well and have built in support for and can be used to develop rather quickly. As far as waiting for the compiler, the wait is usually only a few seconds. Few meaning 4 or 5 or 6. Not minutes. For many aspects you do not even need to wait for the compiler depending on how you've architected the system. Though I am not saying having all your code inline and outside of classes is good design it can be done. I really don't think the example you picked was a good one for you case and I'm surprised that was the one you picked. And based on your response and the very generic and specific to your use requirements you've listed, I think it's safe to say you believe Perl is that much quicker to develop in for the tasks you had to accomplish because that is what you know.

    9. Re:Half the time of C# or Java? by jonadab · · Score: 1

      > certainly Perl has a larger library of pre-written modules

      There is that. I like the way someone else stated this:
      "90% of every Perl program is already written."

      Although sometimes I find myself rejecting the existing modules and rolling my own solution for something, for one reason or another. For instance, for the Open Clip Art Library, our upload facility had been using CGI::Lite to parse the form input data, but for several reasons we ended up scrapping that and rolling our own function. We could have tried another module (such as CGI.pm perhaps, or WWW::Form), but rather than deal with the quirks of these and make them fit our needs, I spent fifteen minutes rolling a custom one.

      OTOH, for my personal music track database, I pretty much just slapped a wrapper around Class::DBI and called it done.

      --
      Cut that out, or I will ship you to Norilsk in a box.
  106. agreed--cleanup needed by idlake · · Score: 3, Insightful

    The profusion of library modules with overlapping functionality is a real concern. The confusion over a standard window system (wxPython, Tk, ...) is actually just another example of that.

    The sys/os split, logical as it may seem to the experienced Python programmer, also confuses Python newbies, as does the fact that string needs to be imported and that re is yet another separate module.

    I think Python would do well with a major library cleanup, removing rarely used and duplicated functionality, and improving the quality of the library code that is there.

    Furthermore, I think it would help for common string, I/O, OS, and regular expression functionality to be importable either via a single import statement (without name conflicts), or to be simply present in the default namespace.

    1. Re:agreed--cleanup needed by Repton · · Score: 1

      The string module is deprecated these days, I believe. The string functions are now string object methods. (eg, instead of

      string.split('foo.bar', '.')
      , you would now say
      'foo.bar'.split('.')
      )

      In terms of cleaning up the standard library --- this may be one of the things that happens in Python3000 (the first release which is allowed to actively break backwards-compatibility).

      --
      Repton.
      They say that only an experienced wizard can do the tengu shuffle.
  107. that's a very old debate by idlake · · Score: 1

    It will take several years to decide the issue.

    This issue hasn't been decided for half a century, what makes you think it will be "decided" within another several years?

    However, it just may be that the problems solved by compile-time checking are not actually the problems that make programming-in-the-large difficult to do

    Who said they were? Static type checking fulfills an important function in large programming projects. That function is not necessarily what you would understand as "programming in the large", it may well be "programming in the small". But when building large systems, you need to do both a little bit of "programming in the large" and a lot of "programming in the small".

    If there is anything like an answer emerging at all, it is that the Java and C# approach seems pretty good: those languages use static type checking by default, but they also give you dynamic type checking, reflection, and code generation when you explicitly ask for them. The existence of such a compromise won't shut up the people who are religiously in the static or dynamic camp, but it helps the rest of us get our work done faster and more safely.

  108. Re:Too bad... by Anonymous Coward · · Score: 0

    Harump! Harump! Harump!

  109. Time to pimp the pike. by Anonymous Coward · · Score: 0

    Use pike. Its a statically typed, object oriented scripting language with a curly brace syntax. So your example would be found at "compile time". If you have A declared as a string, then your second line of code will be a compile time error (bad type in assignment, expected string got function).

  110. Re:Too bad... by Hast · · Score: 4, Insightful
    What's the point of making it work properly?!?!? Surely you have mis-spoken here.

    Another poster already made a clarification on this. I didn't "mis-speak" I was just a bit obscure with my meaning. Point being, if you code in C/C++ you'll spend a lot of time making the program work correctly. If you write in eg Java or Python you can get the program working correctly in a fraction of the time. This means you can add polish or move on to new stuff.

    Point being, you are more productive in other languages as you don't have to mess with the details so much.

    Whether you are trying to run a realtime application like desktop video conferencing or create a document in a word processor, it doesn't really matter. What ever it is that you try will be a struggle because the system's resources (CPU cycles, memory, swap space) are consumed by all those "noncritical" apps and their inefficiencies

    First off, I'm willing to bet that virtually none of the little apps you currently have running are written in Java/Python whatnot. A sloppy coder can leak memeory in any language. (In fact I'd say it's a lot easier to leak memory in a language without a GC.) So moving to C/C++ doesn't really fix the memory issue.

    That they consume enourmous amounts of CPU is also not really true. Those processes I have running on my machine all go in at 0% CPU time. If you add them together they might reach a few percent. Not really something which will stop you from typing in Word.

    The fix for this "problem" is to get an OS with a descent scheduler so you can prioritise processes properly. That way your real-time applications won't suffer because your little application wants to check for new mail.

    What's the point of such a powerful system? Speed! That's the point. Speed is important.

    No, bragging to your friends that you can get 180 FPS in Doom3 is important. Very few people actually need a 3GHz 64-bit CPU with 2GB memory, I have one and I sure as hell don't need it.

    And while code has become more bloated and unoptimised by the years a lot of that is because today a computer can do quite a hell of a lot more than say 10 years ago. Is all of that necessary stuff? Hell no! Is it more fun? Hell yes!

    Finally there is one specific area of consumer software that actually demands better computers. That is games. Interestingly enough that area also have many of the best coders.
  111. Replacement for Java? by Anonymous Coward · · Score: 0

    ...or a replacement for VB6? What little I've heard is Visual Basic (which I know from experience has got to be the most successful garbage programming language in a long while) and Python are often used in the same sentence, with disparaging remarks reserved for the former. Given that a few programmers out there are peeved that VB6 is being phased out in favor of VB.NET (how successful has that been?) and Java is controlled by another single company for the most part, this leaves Python.

  112. Oh come on, insightful? by Anonymous Coward · · Score: 0

    He was "thrilled" to "discover" hashes. Every decent high level language has this data type, wether its called a hash, a mapping, a dictionary or an associative array, its not new and its not thrilling.

  113. Whoa, this is all crazyness. by Anonymous Coward · · Score: 0, Insightful

    Eric Raymond is not a top programmer. He is barely a programmer at all. He has contributed nothing but self obsessed posturing, no worthwhile code has ever come from him.

    Second, spending 20 minutes with python will not cure the whitespace problem. It is 100%, without a doubt a mistake. I have a 12000 line 3 man project in python, and the whitespace issue is a very big problem. We are looking for a proper language to migrate to partly because of this.

    And typing is a real problem. variable = obj.function and variable = obj.function() are both legal, and both compile. They are not equivilent and a language with proper typing would catch such errors.

    1. Re:Whoa, this is all crazyness. by blackhedd · · Score: 1

      If you really hate the whitespace thing, then try Ruby.

      var = obj.function
      var = obj.function()

      There's some validity to your point here. In this case, static typing signals you at compile time that you made a "stupid" mistake (ie, a mistake not caused by an improper understanding of the program requirements). But a dynamic language would signal the error just as quickly, because you'll get a clear, obvious error the first time your code runs.

      A 12000 python program probably translates to 20-40 thousand lines of Java. Either way, it's a small program. Do the conversion and tell us what you find.

    2. Re:Whoa, this is all crazyness. by Black+Acid · · Score: 2, Insightful
      There's some validity to your point here. In this case, static typing signals you at compile time that you made a "stupid" mistake (ie, a mistake not caused by an improper understanding of the program requirements). But a dynamic language would signal the error just as quickly, because you'll get a clear, obvious error the first time your code runs.

      Though the error may be clear and obvious, knowing it the first time the code runs can be too late. I've wrote code that can only run a few weeks every year (nothing important, but the nature of the program limited it to running only at very specific times), and Python has allowed numerous stupid bugs (typos, etc.) to stay dormant until I was able to run it. Static typing would have been very useful in this case.

      Pychecker is a step in the right direction. It doesn't do very advanced type checking, but can warn you about inconsistant return types (returning a string in one path, but another data type in another, for example) at least. MJD's Strong Typing and Perl discusses how strong and static typing can be done right (in ML), in order to prevent many bugs at compile-time (in his case, infinite recursion). I hope we see more options for static typing in Python, if only as an option. I wouldn't want to not ever be able to write simple Python programs without declaring every variable, but for larger programs, static typing is definitely useful. Maybe in the future we'll see more languages that are able to prove that a program is correct (using static typing, etc).

    3. Re:Whoa, this is all crazyness. by asdfghjklqwertyuiop · · Score: 1

      Second, spending 20 minutes with python will not cure the whitespace problem. It is 100%, without a doubt a mistake. I have a 12000 line 3 man project in python, and the whitespace issue is a very big problem. We are looking for a proper language to migrate to partly because of this.


      What exactly is the problem with the whitespace? The meaning of whitespace in Python are exactly the same as the indentation conventions you've used in C, C++, Perl, Java.... I used to be disgusted by the whitespace thing but then I actually tried python, and I never was bothered with the whitepsace-as-syntax thing. The reason is that the way the indentation in python works exactly the same as the way I've already been programming for years in other languages... It is completely intuitive. If you've been programming in C, C++, Java or Perl or similar languages then you already know how that aspect of python sytax works.

    4. Re:Whoa, this is all crazyness. by Anonymous Coward · · Score: 0

      What happens when you use 3 spaces to indent, someone else uses 8, and I am not a dumbass so I use indents to indent? Oops, that's right, we have to fight over who's style we use, and then we have to be pissed off and less productive now that we're working in an uncomfortable environment. With a language that has block level delimiters, wether they are curly braces, "begin" and "end" or whatever, you can code in whatever style you want, then when you checkin your code, you re-indent it using a simple script or the indent command if you are doing C/C++. This isn't possible with python.

      Even cutting and pasting code from other files or worse, from an example on a webpage can completely hose the file with python.

      So, now that I have explained a couple reasons why whitespace is bad, please come up with a reason why it is good.

    5. Re:Whoa, this is all crazyness. by asdfghjklqwertyuiop · · Score: 1

      What happens when you use 3 spaces to indent, someone else uses 8, and I am not a dumbass so I use indents to indent? Oops, that's right, we have to fight over who's style we use, and then we have to be pissed off and less productive now that we're working in an uncomfortable environment. With a language that has block level delimiters, wether they are curly braces, "begin" and "end" or whatever, you can code in whatever style you want, then when you checkin your code, you re-indent it using a simple script or the indent command if you are doing C/C++. This isn't possible with python.


      So you decide on a standard, such as tabs. When somebody who'd rather use 3 spaces to indent checks out the code they do the reverse of what they do when they check in in the above scenario.

      If you really want to you can mix indentation styles as long as every line in a particular block uses the same style. This is valid python:
      def func2():
      # indented with a tab
      print "bleh2"
      if 1==1:
      # indented with a tab and three spaces
      print "yeah"
      print "yeah2"

      def func():
      # indented with 4 spaces
      print "bleh"
      print "Bleh2"
      What else do you want? Most programmers I know don't like to work on code where the indentation style constantly changes from one line to the next (let alone within the same project) - why is it a big deal that python doesn't either?

    6. Re:Whoa, this is all crazyness. by Ben+Hutchings · · Score: 1
      I have a 12000 line 3 man project in python, and the whitespace issue is a very big problem.

      Or perhaps lack of a coding standard.

      And typing is a real problem. variable = obj.function and variable = obj.function() are both legal, and both compile.

      Why shouldn't they? Try writing some unit tests.

    7. Re:Whoa, this is all crazyness. by Ian+Bicking · · Score: 2, Insightful
      If you are writing code that only gets run infrequently and needs to work, you need to use unit testing. It's not a good idea, you ABSOLUTELY MUST TEST. Unless it doesn't matter if it works, and then who cares?

      You'll be able to write the code in Python, and the tests, in less time than most statically typed languages. Many would argue that you can write code and tests in any language faster than writing WORKING code without tests... but that starts down a different avenue of discussion.

  114. I'll say it again: by Anonymous Coward · · Score: 0

    I should NEVER have to debug whitespace, EVER!

  115. Re:Too bad... by Surt · · Score: 1

    I've heard and used those expressions. Let me tell you what we mean by them at my company:

    Processors are cheap -> it is ok to implement superior features, even if they are more cpu intensive than inferior features.

    Memory/Disk are cheap -> it is ok to use a lot of memory or disk to implement a superior feature or a faster algorithm in important parts of the code.

    As a result, we make the highest quality, best selling software in our industry.

    --
    "Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
  116. Re:Too bad... by Money+for+Nothin' · · Score: 2, Insightful

    If only more geeks considered the economics of what they're doing, as you have...

    The logical extreme of the "all apps must be as fast as possible" argument is to code in ASM. I suggest that anybody who pushes this argument write every app in ASM. See how long it takes before this person gets fired for inefficiency...

    Why are some coders hesitant to "use the right tool for the job"? ASM might be necessary if you're optimizing a crypto or compression loop, while C or C++ might be more appropriate for the rest of the app, but Perl or PHP are surely more-appropriate languages for web-scripting! Duh.

    But no, we have these "code everything in C, C is the be-all end-all of languages" dolts... :(

  117. Re:Too bad... by Anonymous Coward · · Score: 1, Informative

    "It's slow" is entirely valid.

    Lets be serious -- Java isn't slow so much because of any real technical issues with the language, but because of the mentality surrounding it.

    The mentality is to overdesign and overengineer. Everything must be reusable, nothing should be written from scratch if it can at all be avoided. Don't try to understand the problem, get the module that advertises the solution you need and drop it in. Speed? Let the RDBMS/window toolkit/JVM worry about it, programmer time is expensive, you know!

    This mentality certainly is not limited to the Java world. This mentality is a facet of "enterprise" scale software development, which you can apply to any language; Java is simply unique in that the Java world goes far out of its way to facilitate this model.

    I find that under such a model, the end result is a dreadfully slow, frustrating product which prompts developers to make severe compromises or shove in workarounds at the last minute for speed.

    Case #1: Windows NT 4 maintains a SAM database to control access. Pretty clever, keeping it all in a centralized database, but the sucker is massive and takes a long time to load on startup. Waiting for the damn thing to load on some servers was taking 10-15 minutes (I shit you not). The boot process already took 2 or 3 minutes, and to wait 10-15 more minutes on top of that before you can log-in is agonizing, so Microsoft put in a hack to rig it so you could login with the barest bones part of the SAM loaded.

    Of course, you logged in, but on the server we found that if we launched anything an administrator would want to use, the management tools would either hang until all of the data got loaded, or crash because it was working on a dataset that was rapidly changing.

    Case #2: Large application suites generally take a long time to start because they're organized into numerous modules that all need to initialize and load when the app is started. As the app gets more featureful, load time shoots up. Developers would at first try hard to minimize the impact of their module load times, but as the features kept creeping it, they realized that there was no hope -- the load time was well past the 10 second mark and the user was getting irked. So, they added the splash screen with a status indicator! Once that went in, developers don't try so hard to keep their module load times down, so it stretches into minutes.

    It doesn't occur to anyone until after 500,000 lines of code are written and they see the shell of the app running that they should worry about load time. By then it's far too late.

    Case #3: the RDBMS is on a giant beast of a server, it's got a terabyte of RAM, 64 processors, -- no worries here: the developers start getting lazy and write O(N^X) performing queries. They don't notice how slow it is on small dataset, and they go with it. Besides! The RDBMS is a monster that can handle anything! But then it goes into production and Y is 100,000,000 and X is 100 and a couple of these queries happen a second. Oops.

  118. 'cause it's prettier by Tony · · Score: 1

    I've used whitespace-blocked programming languages (MUMPS, anyone?) and they blow. They blow so hard, they suck.

    Someone (I think it may have been Stroustrap) said (and I paraphrase), "The restrictions of the language translate to restrictions in the programming solution." I find white-space blocking restrictive and somewhat... arbitrary.

    I understand these are my opinions, and others feel differently. Python looks like it might have been a good language for me if it wasn't for the pain of whitespace blocking. But you know what? It doesn't matter, because Python is there for those that like rules and restrictions, and Perl is there for those that thrive in chaos, and Forth is there for those who like to invent their language to fit the solution every time.

    Lisp is there for those that like lots of tiny little chunks of things. C is there for those who aren't man enough for assembler. C++ is there for those who like pain (those are called masochists, right?). Objective-C is there for those who can't *quite* commit to Smalltalk. COBOL is there for the clearly insane obsessive-compulsive.

    Java is there for those who used to listen to marketing hype. C# is there for those who grew disillusioned with the old marketing hype, and who listened to the *new* marketing hype.

    That's the great thing, even about sucky languages like Python. Everyone has their place.

    Mine is INTERCAL.

    --
    Microsoft is to software what Budweiser is to beer.
  119. no by Anonymous Coward · · Score: 0

    Just because you can't think of a reason for it doesn't mean it should be a syntax error.

    There are perfectly good reasons why you'd want to store method references (x = obj.method) that way. The fact that you can then use the reference x() instead of obj.method() means the assignment is not a "dead-end".

    If you're in the habit of forgetting parenthesis in function calls, perhaps that's something you should work on instead.

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

      It is the backslash that is used to extract the function reference on the right side. However, the variable getting the value on the left side, looks like just any other "normal" variable, i.e. $var. So there is still no difference between one that contains a string and one that contains a function address.

  120. Re:Too bad... by jgrahn · · Score: 2, Interesting
    "Bad programming" has many points to it. I'd include using an old-fashioned language like C or C++ in a system which does not require huge speed or efficiency (which is almost everything these days). It increases the development time of a project, increases the code complexity, increases the chances of runtime bugs, and increases the potential severity of what bugs you do have.

    C may be old-fashioned, but please don't lump C++ in with it. Chances are you haven't even seen modern C++ source code, which in practice has little to do with C source other than that you can link to C libraries easily.

    That said, I'm all for programming in higher-order languages (e.g. Python) and I prefer to do so, but some problems are better solved in C++ or even C. It doesn't even have to be about efficiency; things like static type checking can be essential in large programs when it's hard to test all code paths.

  121. Re:Too bad... by zootm · · Score: 1

    I've seen plenty of poorly-written, slow code written in C and C++ -- the languages themselves makes it easier to write poor code. There's a time and a place for C, and it's not always -- or even usually -- that time, nor that place.

    These tools would not be in widespread use over C or C++ were they not useful. Doing it "properly", using your definition, is more error-prone, and takes longer. But sure, if you want it to run as fast as it possibly can, go for it. It's just not a requirement for 90% of applications, and the benefits just often don't justify the risk.

  122. hmmm by Anonymous Coward · · Score: 2, Interesting

    There are a lot of things wrong with what you are saying. It looks like while you learned the language, you have a lot of trouble adapting to some of the "paradigms".

    Asking for functions to return None instead of raising exceptions on errors ruins a fundamental concept of "focus on what the program should do" which makes exceptions useful. A significant percentage of C code is "if - else" statements dealing with such return codes.

    In C or Perl, writing a file is a painful operation, along these lines:

    open file for writing()
    if open failed {
    handle error
    } else {
    while not finished {
    retvalue = write content to file
    if retvalue not good {
    handle error
    }
    }
    close file
    if close failed {
    handle error
    }
    }

    Note how inline error checking not only makes the bulk of the code, but also makes it less obvious what the code does. In Python, you'd do something along these lines:

    try:
    open file for writing
    while not finished:
    write to file
    close file

    except open failed or write failed or close failed:
    handle error

    That is even assuming we want to handle the error and not let it propagate up, which is made possible by the exception mechanism, and would be made difficult if all those functions would return on error.

  123. Re:Your 5 cents?Heres my 2 cents. CPAN == crap. by Money+for+Nothin' · · Score: 1

    Typical Example Mr. Golfplayer. Found a great little OSS application, needs compiling, uses Perl, running make, opps need to use CPAN, "Oh crap, company firewall blocks FTP",

    You forgot about HTTP via the LWP module, or using an external call to wget. Think the company blocks outbound HTTP? (well, for call-center employees, yes, but for developers?)
  124. Re:Too bad... by zootm · · Score: 1

    With automated memory (and occasionally other resource) management present in these systems, the "background" applications you describe will generally disappear into the background, and not consume resources. Which is comparable to a well-written program in C or C++, say.

    I'm not sure about you, but Java/Mono apps have never caused my computer any strife while in the background, whereas "poorly written" applications implemented in C or C++ have frequently brought my system to the ground with memory leaks and the like.

  125. Re:Less Time Coding, More Time Debugging/Maintaini by m50d · · Score: 1

    Have you ever tried Python? It's far more readable than Java, the clean indentation, limited for loop, and general verbosity without anything unnecessary make it much easier to maintain than any other language I've ever worked with. The non-compilation also means it feels easier to debug, there's no separation of compile-time and run-time errors but that's actually a good thing, because it doesn't really matter where the error occurs, you just need to see where it is and fix it, so there's no need for two "cycles" when debugging.

    --
    I am trolling
  126. Re:Too bad... by zootm · · Score: 1

    I do agree, largely. I do not like C++ as a language though. C's use can be justified for low-end systems, but C++ is in more of a quandary, since its architecture has been superceded by newer languages -- but yes, if there is a larger system that absolutely, positively has to run fast, it might be beneficial to use C++. Most of the time, though, I think of it as more of a legacy thing in a lot of ways.

    Static type-checking is implemented better in a lot of languages than C++, although yes, Python's a special case at not having that feature.

  127. Re:Too bad... by Anonymous Coward · · Score: 0

    C may be old-fashioned, but please don't lump C++ in with it. Chances are you haven't even seen modern C++ source code, which in practice has little to do with C source other than that you can link to C libraries easily.

    Chances are, you haven't even seen the code in modern C++ compilers, which in practice has little to do with reality or sanity.

  128. MS open source by Anonymous Coward · · Score: 0

    At least no one at /. can complain that MS is hurting open source software by providing a way to compile python to CLR.

  129. this is why by Anonymous Coward · · Score: 0

    The paragraph below is a great example why people usually *want* stuff they really do not *need*, and why not all programmers can be language designers:

    It reminds me of a joke I once heard regaing a guy who, after getting hard contact lenses fitted said, "It feels like a toenail is stuck in my eye", to which the optometrist responds, "Don't worry, you'll get used to it." He replied, "If I've got a toenail stuck in my eye I want it out, I don't want to get used to it."

  130. Re:Too bad... by zootm · · Score: 1

    Interesting point, although I'm not sure you're even trying to object to Java itself. To be fair, though, careful selection of packages will, in a lot of situations, be a better solution than complete reimplmentation (a lot of things are basically trivial-but-time-consuming to implement). And yes, Java's GUI support is awful (although a couple of apps seem to have worked past that, recently).

    And dear God. O(N^X) queries are a horrible, horrible thing, no matter which language is lumped with dispatching them.

  131. swapped styles ? by Anonymous Coward · · Score: 0

    I recall the "old" style as being

    if (test)
    {
    expression
    }

  132. Python is just Dumb by Univac_1004 · · Score: 0, Troll
    Python has been dumb-downed for people who don't understand how computers work. Or want to know.

    But even with that goal it still includes some very irritating and useless constructs.

    It's best place is to replace the original BASIC as in introduction to computer programming course... say at the early middle school level.

  133. Re:Too bad... by fyngyrz · · Score: 2, Insightful
    Once you've fixed the gazillion-th bug caused by dangling pointers or out of bounds access you start to realize that...

    ...you're a really bad programmer and someone should teach you a few things, like how to manage resources.

    I program in C every day and I haven't coded an error of the type you describe in over a year. I would know if I had -- our C memory manager catches all manner of pointer problems, accounts for all memory allocation and freeing, memory over- and under-runs, gives us stats on memory allocations and so on.

    I'm definitely a Python fan, but your agument against C isn't valid. It's just an argument that crummy programmers write crummy C programs, which is not news.

    Python is a perfectly reasonable language for coding certain types of applications, and it is also a good language for programmers that aren't that skilled because it puts a strong safety net in place for many types of errors with the exception system it uses. C is something else entirely.

    --
    I've fallen off your lawn, and I can't get up.
  134. Not perfect but good for many things by ibm1130 · · Score: 2, Interesting

    Last week I realised I needed some way of generating a bunch of stuff on the fly as prep work for a current project.
    It had been mentioned in my hearing that Python was acceptable within the constraints for the overall program.
    Figuring it was at least worth a look, I spent a day playing with Python basically putting together the things I needed to to do the task. In spite of a couple of disruptions, my code was fully functional and more or less ready for primetime by COB Friday.
    I wouldn't use it for the real-time parts of what I'm doing if only because the framework being used is suitable as it stands ( C++/C/FORTRAN ) but for most other things it rocks.
    I plan to push for making Python the standard glue language at the office.

  135. Re:Too bad... by Egregius · · Score: 0

    Modded insightfull? Just because someone doesn't use up all his resources playing Nethack?

  136. Re:Too bad... by globalar · · Score: 2, Insightful

    "Speed is important"

    ...just like price, just like quality.

    You meet the demands of the project/customer. I'm not really arguing with you, but this is sort of the point of a thread about Python. It's a tool that helps balance this process for the developer - this in turn should result in benefits to the enduser.

    It is nice to have a perfect balance, but efficiency is relative and (developer) resources are finite. Always.

  137. Re:Too bad... by masklinn · · Score: 3, Interesting
    Another poster already made a clarification on this. I didn't "mis-speak" I was just a bit obscure with my meaning. Point being, if you code in C/C++ you'll spend a lot of time making the program work correctly. If you write in eg Java or Python you can get the program working correctly in a fraction of the time. This means you can add polish or move on to new stuff. Point being, you are more productive in other languages as you don't have to mess with the details so much.
    One of the very important features of Python (i don't know much about java as i hate that language, but i'd assume it's close even though it'd be tought to be better than Python in that field) is the ease of creating C/C++ modules/extensions to the language.

    That's where i'll desagree with whateverparent who said that high level "so called scripting languages" should only be used for prototyping/testing and should be cast aside for final app:
    It's well known that ~10% of an application's codebase consumes ~90% of the application's resource needs (source: my ass), high level modular languages with easy ASM/C/C++ integration such as Python therefore allow you to:
    • Develop the whole application in a fraction of the time you'd need to develop C/C++ version
    • Using it as a "proof of concept" of the app's viability
    • Fully test both application and test-cases (including unit tests
    • Identify performances "roadblocks" modules/parts
    • Recode these modules in a more efficient language using the already perfect testing tools
    You'll use maybe 10% of the "full C/C++ approach" coding time to code the initial java/python/ruby/whatever high-level language you prefer version, 5% or maybe 10% top to recode the performance-critical modules in low-level languages, and you'll get... 99% of the low level version performances for under 20% of the dev time (with less chances of memory leaks and better portability to boot)

    The stupid part is that most people don't even realise the ease of embedding low level modules into modern high level languages, and therefore use a "all or nothing approach", either full high level or full low...
    Learn how to use your tools guys, low level compiled and high level interpreted language do not oppose themselves, they're complementary and both are necessary to get the best out of your dev teams
    --
    "The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
  138. Why ruby won't displace python. by Anonymous Coward · · Score: 0

    Ruby is first of all, incredibly slow. Second, it doesn't have real threads. And third, it doesn't offer anything special. The best argument for ruby anyone has come up with is "look at rails", which could be done in python or perl just as easily, and "the syntax is like natural language", which is both wrong, and not a good thing.

    1. Re:Why ruby won't displace python. by CatGrep · · Score: 1

      Ruby is first of all, incredibly slow.

      Do you have numbers to back up this assertion? Sure, Ruby tends to be slower than Perl, for example, but what if you compare OO Perl to OO Ruby (OO Ruby is the natural way to write Ruby of course). OO Perl tends to lose out againt Ruby in performance tests - lots of extra overhead for objects in Perl apparently. Ruby tends to score a bit slower than Python for comparative tasks, true, but it's something like 5 to 10% slower not two or 10 times slower. If that's "incredibly slow", then Python is "incredibly slow" as well. Also, it's quite easy to write C extensions for Ruby (or inline C using RubyInline) for the 10% of your code that is really speed critical.

      Note that I said "looks like a natural part of the language" not "the syntax is like natural language".

    2. Re:Why ruby won't displace python. by Some+Random+Username · · Score: 1

      While I am not sure I would go so far as to say ruby is "incredibly" slow, it is definately quite a bit slower than python. Check out http://shootout.alioth.debian.org/. There's a very big difference in speed for things like object creation, method calls, etc. Core language functionality that can't be made into a C module. And of course, python still lets you make C modules too, its still nice to have your normal code execute faster though.

    3. Re:Why ruby won't displace python. by davegaramond · · Score: 1

      Let's wait for YARV to be merged with Ruby at the end of this year. Comparing current Ruby interpreter (which is AST-based) compared to Python compiler (VM/bytecode-based) is not exactly fair. Plus Python and Perl have been around longer and have undergone much more optimization tweaks.

  139. Glade. by Anonymous Coward · · Score: 0

    GTK is portable, and you can make a GUI for it in glade. Then save that GUI as an xml file, and use it to quickly and easily create the GUI portion of your app from any number of languages, including C, C++, perl, python, pike, and ruby.

  140. No, you are quite incorrect. by Anonymous Coward · · Score: 1, Informative

    Pike is statically typed and requires you to declare variables, but is still just as fast and easy. For your example:

    int|float twice(int|float x) {
    return (x * 2);
    }

    See, it doesn't have to limit the functionality of the function twice. And you still get all the benefits of static typing finding mistakes for you at compile time.

    1. Re:No, you are quite incorrect. by Homburg · · Score: 1

      But what if there are an indeterminate number of types for which x * 2 makes sense?

      Besides which, having to specify types is almost always redundant - OCaml is strongly typed, and you can do something like this:

      let twice x = 2 * x;;

  141. You are an idiot. by Anonymous Coward · · Score: 0

    CURLY BRACE PLACEMENT HAS NEVER BEEN AN ISSUE. Man indent you fucking whitespace loving morons. Curly braces are a *feature* that allows you to indent and re-indent any code automatically. Python breaks this, and makes it completely impossible to re-indent people's code, and you don't even know if the code is indented correctly to begin with. (bugs can hide behind space vs tab problems, and you will often totally miss them). We knock the lack of braces BECAUSE we have tried it, because we are experienced programmers who have been coding since before you are born, and realize that the lack of block syntax is a problem, not a feature.

    1. Re:You are an idiot. by asdfghjklqwertyuiop · · Score: 1

      If the code is consistently indented to begin with, then reformatting it to a new indentation style is more or less a search & replace operation.

      If the code is not consistently indented but still valid python (ie, indentation style varies from block to block) it is still possible to change the indentation style programmaticly.

  142. Nope, wrong answer. by Anonymous Coward · · Score: 0

    Someone who doesn't understand what semantic structure is, and is stupid enough to not realize that block delimiters allow computer applications to indent and re-indent code automatically, while syntactically significant whitespace makes it impossible to assertain wether or not code is in fact correctly indented, much less reindent it to a standard indent size/type.

  143. Re:Too bad... by mcrbids · · Score: 1

    Today, the preferred system is 3Ghz, 64bit, with at least 2 gigs of RAM. Why? What's the point of such a powerful system? Speed! That's the point. Speed is important. Code efficiency is important. But, as programmers continue to deny this and produce poorly written and bloated/slow apps or use inefficient languages, the time will come when a 6Ghz processor is not enough. Doesn't that sound stupid?

    Sure it does. But let's take a look at it:

    1) It might cost the company an extra $25,000 to go through the performance tweaking to get it "right". Yes, a small team of coders, and a calendar month.

    2) Let's say that they improve performance by 100%.

    3) Assume that the software is server-based.

    4) Cost to get software running "right" - $25,000. Cost to upgrade the server to a dual proc - $1,500. Which are YOU going to do?

    I'd suggest that you read a bit more on the realities of software "BLOAT" before you go judging.

    It's not what you think it is.

    People, given the choice of better performance or better features will almost always choose the latter, because they can "do more". So, what's the economic incentive to hand-craft everything in assembler?

    "c" is a compromise solution - I remember when it was considered a HIGH level language! The price/performance curve is always reshaping itself towards higher and higher level languages. Get used to it!

    --
    I have no problem with your religion until you decide it's reason to deprive others of the truth.
  144. The joke is on you by Anonymous Coward · · Score: 0

    Your example is painfully silly and does not even compile. You neglected to create a sayHello method and looks like you criticized someone else for not creating a class which is just silly because while you define one you do not create it.

  145. I have tried ruby. by Anonymous Coward · · Score: 0

    It doesn't solve all my problems with python, and it doesn't support threads. This is not a show-stopper, but it does lose points.

    And there isn't "some" validity to my point, its a real and serious problem. There is no assurance that such an error will be caught when I run my code the first time, only when a certain, possible rare sequence of events causes that particular line of code to execute. That bug could be there for weeks after it was made, without anyone noticing, and then by the time we notice, its a problem that just affected a user, and we've got to debug it now. In a statically typed language it would have been caught immediately, and would save time having to debug a silly mistake.

    I'm not sure why you are comparing to java, as there's no way in hell I would write this in java, but we have started re-implimenting the base of it in perl, ruby and pike to see which seems like the best bet. My vote is currently on pike due to this exact static typing issue.

    1. Re:I have tried ruby. by blackhedd · · Score: 1

      There's something I don't get. Why are you writing lines of code that don't immediately get executed and tested? Especially in such a small project?

      Part of the "best practices" for dynamic languages is comprehensive unit testing. Ruby makes this trivial to do, since all the required class support is built into the language.

      Ruby does have threads. They're akin to the old Java "green threads" but they are there.

      No way in hell: why wouldn't you re-write this in Java? That's a serious question, I want to know why not. I suspect that your answer will shed some light on the OP, which was "Python moves into the Enterprise." On this ground, Python and Ruby compete against Java, not each other.

    2. Re:I have tried ruby. by davegaramond · · Score: 1

      Current Ruby interpreter does support only green threads, but real OS threads will be support in the new Ruby VM, slated to be integrated at the end of this year.

  146. You are all wrong by Anonymous Coward · · Score: 0

    There have been many posts concerning the speed of each and every possible language. Some have gone as far as to link to several studies with nice charts and graphs to conclude that X language is faster or X1 is truly the fastest. You are all wrong.

    A laguage, in of itself, cannot be measured by speed. A language is merely a group lexical elements with a particular syntax. That syntax has an associated semantics to it. That is it! It is pointless to compare languages purely on speed.

    Now, what we can compare is the implementation of a particular language. For example, we can compare the speed differences between the intel compiler and gcc for the same piece of C code. We might find that in most cases, gcc is slower that the intel compiler. Does this mean that C is slow? No! Now, take the same algorithm and port it to Java. Lets imagine that the Java version was 10x faster. Does this mean Java is inherently faster langauge? NO! It means that the compiler, JIT, and HotSpot implementations are better at tranlating Java source code down to the machine level.

    So, in summary, a language by itself should NOT be measure in speed. It should be measured by the following:

    Maintainability
    Ease of Use
    Learning Curve
    Clear Semantics
    Support
    Documentation
    Standard APIs

    Most often, when languages are compared, you are merely comparing the differences in constants in a language! Lets say we implement the Quick Sort Algorithm in C++ and Python. We will probably find that the C++ version is slightly faster. What does this mean? It means the the implementation of C++ generates fewer constants that the Python Implementation. So, the Python version may be slower, but it is only in constant O(1) differences and in most cases this does not matter! Eliminating extra constants ( in any language ) is stupid when you have chosen the wrong algorithm in the first place! ( such as an order n^3 when it could have been n*log(n) ).

    So, what is the moral of this story? Pick the right langauge for the right job. It you are doing advanced GUI development and prototyping, C++ is probably not the way to go ( since it is harder to write fast and correctly ). However, it you are doing low-level real-time I/O where constants do matter, then C/ASM is probably the way to go. After you have chosen he right language for your task, you must choose the right algorithm! Algorithms are the key! Algorithms are the only true way to measure the efficiency on any program in terms of memory and speed.

  147. Re:Too bad... by Anonymous Coward · · Score: 0

    you obviously don't know what "enterprise" means, let me clue you in, it does not inclulde any of the things you are arguing, all those are DESKTOP apps not enterprise applications.

  148. Re:Python is dead, long live Ruby! by Anonymous Coward · · Score: 0

    And uglier. Kinda like perl. Go away, troll.

  149. Don't use Python just because ESR loves it. by SimHacker · · Score: 1
    You should use Python IN SPITE OF the fact ESR loves it. Don't let him ruin another perfectly good language with his Vulgar Raymonsism.

    -Don

    --
    Take a look and feel free: http://www.PieMenu.com
  150. web stuff is pretty decent in python by hubrix · · Score: 0

    Which is mostly what "enterprise" software is. I've been using Spyce (python server pages) for a few clients and it's a very decent tool. There is however a serious lack of standardization that a true enterprise technology needs. In Java there isn't a 100 different ways to do something right and it helps in commodotizing the Java programmer which in our geek eyes is a Bad Thing but in the view of corporate money it is a Good Thing.

    --
    Screw realty just hook me up another monitor!
  151. No you are misusing the syntax by goombah99 · · Score: 1
    In attempting to exaplin why return values are less desrirable than automatic exception throwig You wrote that default values lead to code like this:
    open file for writing()
    if open failed {
    handle error
    } else {
    while not finished {
    retvalue = write content to file
    if retvalue not good {
    handle error
    }
    }
    close file
    if close failed {
    handle error
    }
    }

    Well That's certianly not how I would write it. now lets look at how one would do this in a good language that returns default values like Nulls.

    open file for writing() or throw open_error

    while not finished {
    write content to file or throw write_error
    }

    close file or throw close_error
    That I'm sure you will agree just as readable and maintanable as the try-wrapper. Indeed the above does not preclude having a try-wrapper around it. One of the nice things, any python programmer ought to appreciate, is that the above form is self-documenting. You know where the errors came from rather than having an unexplained branch jump into a non-local piece of code. But the point is that by returning a default value I am free to handle the error or ignore it. I dont have to have the try enclosure if I dont want it. This is especially important when the error is inside of a loop or worse if the error occurs in a nested function.
    for Y in M:
    x = function1( function2(Y))
    If instead function2 might throw an exception instead of a default return value then I have to wrap the thing inside of a try statement when in many cases if it just returned null or zero I would be perfectly happy. lacking that capability I have to write something like this:
    for Y in M:
    try
    temp = function2(y)
    esle
    temp = 0

    try
    x = function1(temp)
    else
    X = 0
    --
    Some drink at the fountain of knowledge. Others just gargle.
    1. Re:No you are misusing the syntax by Anonymous Coward · · Score: 0

      It doesn't always work as nice. Zero is a perfectly good return value for a function, and as such will not allow you to use that pretty syntax (since zero is considered "false" as well).

      For example, strcmp(), wait(), most system calls that would return negative values for errors, etc. The way I wrote it is the way these things are usually handled, and have always been in C and good Perl.

    2. Re:No you are misusing the syntax by Anonymous Coward · · Score: 0

      well yes, the zero return value is not a pancea. there are times when a zreo is a legitimate return value ro one has to explicitly test the return error code instead. But that's mostly theoretical. that is to say in the vast majority of real world situations its perfectly feasible for a return value of zero (or not zero) to signify the error. The convenience and control this offers is not something to sneeze at, its a very powerful tool. It beats having to trap every exception as well.

    3. Re:No you are misusing the syntax by Anonymous Coward · · Score: 0

      The point is that you don't have to handle the exception *right there*, which you are forced to do in the C model.

      Exceptions allow you do decide when you want to handle the exceptions on the stack, and allow for cleaner code. Usually it is irrelevant to the program where a file write fails, the important part is that it didn't work.

  152. forces a person? by Anonymous Coward · · Score: 1, Insightful

    If a person wants to write spaghetti code, they will manage it, even in Python. If a person wants to write intelligible code, they will manage it.

    The most important part of any program is the algorithm. That's what needs to be understood. And Python cannot make a programmer write algorithms.

    I don't see the attraction of Python's forcing you to indent in a certain way.

  153. MS SharePoint stores _everything_ in SQL by melted · · Score: 1

    MS SharePoint stores _everything_ in SQL, and it's pretty darn zippy.

  154. Purpose of dynamic types? by Neoncow · · Score: 1
    I'm trying to understand what the advantage of dynamic typed variables are. I'm told that one of the disadvantages is that the program cannot guarantee that you have an object of the right type.

    So what is the benefit? Is it mainly a productivity thing, where the programmer can type less? Is it that you don't have to cast things? These seem like small benefits when considering you don't have the security of knowing what type your variables are.

    What other benefits exist? Where have I made bad assumptions?

    1. Re:Purpose of dynamic types? by Ambassador+Kosh · · Score: 4, Informative

      One of the benefits is in things like duck typing. Often you don't care what kind of object something is so long as it has some certain method. To put it in a practical way I work with zope which is a python based app server which has an object database as part of it. Often I will run queries and get objects back. Most of the time I don't care if it is a file, picture, dtml document, or any of the many other types in the db all I care is that it has an id and it is willing to draw its url. Those are the conditions I have for working with the object.

      So you work with objects by interface rather then by type. The interface also does not have to be a complete interface. You can implement as much of the interface as you need for something. I have some objects that are not lists and can not be used as lists however I have implemented some methods that make it so you can iterate over them like lists and slice them like lists.

      This makes many tasks far simpler and encourages more regularity in usage.

      How do you check if a substring is in a string, an item in a sequence, a key in dictionary etc? How do you iterate over them? In python it is all the same. if substing in string, if item in seq, if key in dict and the for character in string, for item in seq, for key in dict, for line in file, etc etc etc.

      Types are nice but the types the static compilers have are not the types my apps use. The static type systems just end up costing me more time to develop working apps with then the dynamic typing systems and you have to test the product anyways.

      --
      Computer modeling for biotech drug manufacturing is HARD! :)
    2. Re:Purpose of dynamic types? by ajs · · Score: 1
      "Often you don't care what kind of object something is so long as it has some certain method. To put it in a practical way I work with zope which is a python based app server which has an object database as part of it. Often I will run queries and get objects back. Most of the time I don't care if it is a file, picture, dtml document, or any of the many other types in the db all I care is that it has an id and it is willing to draw its url."

      This is a reasonable thing to do in any language that handles typing through something like an interface. For example, in Perl 6:
      sub display_as_uri($data does locatable) {
      return $data.uri;
      }
      # And here's a sample declaration of locatable assuming a URI package like Perl 5's:
      role locatable {
      method uri() returns URI {...}
      }
      # And an example class that uses this:
      class myimage does locatable {
      method uri($image:) returns URI::URL {
      my URI::URL $u = "http://{.myhost}{.imagepath}";
      }
      }
      # And so....
      print display_as_url( myimage.new("flower.jpg") );
      Here we recieve $data as a generic "Any" datatype, but we make certain assertions about its type: it must provide the identifiable and loctables "roles". It might be an image or a description of a hardware order... you don't care. You just want to verify that it can do what you asked it to do at compile time (well, compile time is a tricky thing in Perl 5, but close enough).

      You can do this with nothing but generic typing, but you lose the ability to make assertions about the capabilities you will be relying on.

      Python could easily do the same thing, but I suspect it would be too radical a change. I know that the changes in Perl 6 have already polarized the Perl community strongly, and we've always been a "you can have it your way" kind of bunch... Python tends to attract people with a strong sense that there is a right and a wrong way to do just about anything, so convincing them that a new way has value would seem... challenging.

      Still, this is not unique to Perl 6, and I think this kind of genric typing coupled with interface assertions is going to become a difficult feature to live without.
    3. Re:Purpose of dynamic types? by Ambassador+Kosh · · Score: 1

      For python looks at peps 245 and 246. http://python.org/peps/pep-0246.html and http://python.org/peps/pep-0245.html

      The first one is Python Interface Syntax allows you to define an interface and check if something supports it.

      The second one is Object Adaptation is an item that builds on the interface system to define adapt an item with one interface to another.

      Both of these things are already used in zope, twisted and other places and it seems very likely that they will be in python 2.5. These features have been used for at least a few years it is just not part of core python yet.

      My point though was that I want to deal with "types" that are not computer types. I want a type that has a URL and id, or I want a type that is callable, or a type that is iterable and supports containment checking. The int, string, list, etc types are not normally the types I care about. You are right that types are important but only if the computer can give you types that match the problem. I do look forward to having more of this stuff in python and would be even okay with some limited type of static typing support so long as it was based on these more useful types rather then computer types.

      One of the things I like about the python interface stuff is I don't have to have things inherit from a base class in order to follow that interface. The interface and the inheritance are separate so I can have something that says it follows a list interface but does not need to inherit from list. I am sure you can see the value of that after seeing some of the truly evil deep inheritance hierarchies. :)

      --
      Computer modeling for biotech drug manufacturing is HARD! :)
    4. Re:Purpose of dynamic types? by ajs · · Score: 1

      Nice stuff. Glad to see my assumptions about the Python community not accepting change were unfounded.

      I'm constantly (and pleasantly) surprised by the communities that support Python, Perl, Ruby, Pike and the like. These languages continue to evolve, take advantage the surroundings and generally make life easier for their user baes. Even PHP continues to grow.

      It's a good time to be someone who enjoys coding.

    5. Re:Purpose of dynamic types? by Ed+Avis · · Score: 1
      My point though was that I want to deal with "types" that are not computer types. I want a type that has a URL and id, or I want a type that is callable, or a type that is iterable and supports containment checking.
      Have a look at Haskell, or ML, or even C++. Essentially any strongly typed language that lets you define your own interfaces.
      One of the things I like about the python interface stuff is I don't have to have things inherit from a base class in order to follow that interface. The interface and the inheritance are separate so I can have something that says it follows a list interface but does not need to inherit from list.
      This is true in C++ too, once you start getting into generic programming with templates. (For example the different kinds of iterator do not inherit from any common base class.) But the syntax is nasty. In languages like Haskell there is also no need to inherit from a common base class to implement a particular interface.
      --
      -- Ed Avis ed@membled.com
    6. Re:Purpose of dynamic types? by Ambassador+Kosh · · Score: 1

      I have done C++ for about 4 years before I decided to use python. I did use templates, stl etc and overall I have to say that I disliked it a lot. Too many syntax structures where nasty and therefore bug prone. You had to spend a lot more time remembering all the details of the language then dealing with your problem. I still don't see why these lower level languages can't adopt some better syntax.

      for i in seq: would not kill them in any way but it sure would make a lot of the stuff simpler. Have you really looked at the newer iteration stuff for C++/java etc. It is all still nasty and far too complex. Other things like if i in container where i can be just about anything and so container can be anything that implements __contains__ or a few other things.

      I have not really looked at haskell or ML and they are worth looking into long term but I use zope for web apps which is also all done in python. I really don't want to move off of zope since I find it is the easiest development platform I have worked with so far (with a HUGE learning curve, it is easy to work with but a hard thing to learn). haskell or ML would have to have some insane advantages for me to consider moving over to them and trying to figure out how to migrate all of the data.

      --
      Computer modeling for biotech drug manufacturing is HARD! :)
    7. Re:Purpose of dynamic types? by Ed+Avis · · Score: 1

      I agree with your comments about C++. Too much syntax, too much thinking about language weirdness. But it's unfair to characterize C++'s strong typing as being all about ints, floats and chars and not including 'real world' types.

      I'm not recommending you leave Python - just be aware of what's out there and don't assume that strong typing means 'awkward like C++'. There are many strongly typed languages where the type checker is a joy to use and really makes your life easier. (especially with type inference)

      --
      -- Ed Avis ed@membled.com
    8. Re:Purpose of dynamic types? by sjames · · Score: 1

      Have a look at Haskell, or ML, or even C++. Essentially any strongly typed language that lets you define your own interfaces.

      It is possible to duplicate the ease and cleanness of Python, but for a language like C++, the best way is to implement Python, then write your code :-)

      I'm only glancingly familiar with ML and Haskell, but those look a bit better. Personally, I enjoy the particular combination of introspection and object mutability available in Python. By adding things to a Python object's dict, an object can gain a perminant new interface well after it was defined.

      In some sense, C++ asks the wrong question entirely of objects. Something wants a particular object method, so it checks the type of the object and based on that infers the presence of the method. Python skips the inferences and gets to the real question 'do these methods exist in this object'. Type is beside the point. If C++ code implements a workaround of that, it has simply implemented a subset of Python or similar language (Since Python is implemented in C and C++ is a superset of C, this is necessarily a possability, but usually a waste of time.)

      Another important (to me) feature of Python is the ease of interfacing with C. My first attempt at that was done with the book open, coding as I read, took only an hour, and worked right the first time. It doesn't get much easier than that.

      C++ was a nice try, but IMHO, missed the mark. The Linux kernel is filled with much better object oriented C than C++ can produce. C<->Python interface code tends to naturally share that characteristic.

      One of these days, I need to dig in to ML and Haskell to see what those are all about :-)

    9. Re:Purpose of dynamic types? by Ed+Avis · · Score: 1
      In some sense, C++ asks the wrong question entirely of objects. Something wants a particular object method, so it checks the type of the object and based on that infers the presence of the method.
      Not quite. With template programming you can quite easily write code that works with any type that has a foo() member function. They do not need to inherit from a common base class. Consider the STL's algorithms such as sort(): they work with any iterators, and an iterator is simply a type defining the * and ++ operators. There is no 'iterator' base class.

      So you have both ways of checking for a method: both by inheritance and by just looking for one with the same name and a compatible signature. This choice is both a blessing and a curse. One obvious difference with Python is that if the lookup fails, the error is caught at compile time. This too has a good and bad side. (I like compile time checking but dislike the syntactic hoops C++ sometimes makes you jump through.)

      It's interesting you mention Linux: my feeling glancing at kernel code snippets in LWN is that they go to a lot of trouble to reimplement in C things that C++ provides with a lot less fuss. After all, C++ was created by a C programmer. What are the kernel folk doing with C that C++ doesn't provide?
      --
      -- Ed Avis ed@membled.com
    10. Re:Purpose of dynamic types? by sjames · · Score: 1

      With template programming you can quite easily write code that works with any type that has a foo() member function.

      Templates do help, but aren't quite as flexible as Python. For example, there are several places in Python where one interface is preferred, but if unavailable it will do it's best with another. The determination can be made at runtime on a case by case basis.

      It's interesting you mention Linux: my feeling glancing at kernel code snippets in LWN is that they go to a lot of trouble to reimplement in C things that C++ provides with a lot less fuss. After all, C++ was created by a C programmer. What are the kernel folk doing with C that C++ doesn't provide?

      More than that, the first C++ compiler was a pre-processor that spit out C code. The primary justification for using C in an object oriented way in kernel is to avoid sweeping complexity and/or bloat under the rug. While complexity hiding may be a good thing in userspace, it is not at all wanted in a kernel. Kernel memory is the most expensive sort in the system because it cannot be paged out.

    11. Re:Purpose of dynamic types? by Ed+Avis · · Score: 1

      Yes, but most of the features of C++ were expressly designed to avoid causing bloat that is swept under the rug. Stroustrup's motto was 'not one extra cycle and not one extra byte' and for the most part C++ achieves this. Virtual inheritance does introduce an extra runtime lookup on each member function call, but this is no worse than what you'd incur if you emulated the same thing in C with a struct full of function pointers (as the kernel does).

      However, advocating 1985-era C++ in the Linux kernel is a bit pointless. It may not have any extra overhead compared to C, but neither does it give you a great deal apart from syntactic convenience. When people ask for C++, they usually want exceptions, virtual functions, RTTI and even templates - and I can understand why the kernel wouldn't want those because they really can cause bloat (and dragging in parts of the C++ ABI and standard library).

      I think I still agree with Stroustrup that there is no good reason to start writing a program in C rather than C++, and if you don't want the extra overhead associated with certain C++ features then don't use those features. But this isn't necessarily an argument that existing C code should have C++ bits bolted onto it.

      --
      -- Ed Avis ed@membled.com
  155. Re:Too bad... by Anonymous Coward · · Score: 0

    Your argument is true for some "Ultimate MP3 player" and like apps, but not for most custom software. If someone is spending $10k - $100k+ for software that is only going to be used on a dozen machines, the cost of buying faster machines is often tiny compared to doing anything but the most high-level optimizations.

  156. try and try again by Anonymous Coward · · Score: 0

    Here is an example of what I see as the pernicious "try" crutch. The try syntax is excellent for certain kinds of errors but one should not be forced to deal with an exception when default value would do. it should be optional but its not this leads to the follwoing: see my answerto a simmilar issue for a worked example of what exactly I mean.

  157. Re:Too bad... by Anonymous Coward · · Score: 0

    i don't know much about java as i hate that language

    So, you don't hate it because you've coded in it and you don't like it, you hate it because some other idiot has told you he/she it was crap?

  158. Re:Too bad... by publius_ovidius · · Score: 3, Informative

    Apologies in advance if I have misunderstood you, but ...

    I think you may be missing an important point here. In older languages, you'll find that the bulk of the work was often thrust on the programmer because the programmer was far cheaper than the computer. One need look no further than the horror of JCL and COBOL to see a high level language that still required inordinate amounts of fiddling by the programmer to get it to play nicely with the computer.

    Today, we find that the programmer is far more expensive relative to the computer. Simple economics dictates that shifting much of the load from the programmer to the programming language will save money. However, that's not the end of the story. Some applications need raw speed. Others do not. Choosing Python or Perl for device drivers or ray tracing is probably not a good idea. Choosing C or C++ for processing log files is also probably a bad idea (though not always.) An "always/never" dogmatic approach to language choice means that one cannot choose the best tool for the job, but is instead forced to twist every problem in such a way that your favored language is an appropriate solution (or, perhaps just as common, to simply ignore those areas where your favored language is a bad choice.)

    In other words, don't be dogmatic. Dogmatism implies that you won't consider new ideas and that's almost always an error, even if the beliefs that you hold as true are true. Developer performance, processor performance and language performance are all factors that should be considered.

  159. Re:Too bad... by Ambassador+Kosh · · Score: 2, Insightful

    You forgot a very important step. The VAST majority of the time those low level bottlenecks are also low level bottlenecks that other people have and there is already a highly optimized c module to do that task with a python binding already. So you just use that library and the problem is solved and you did not need to write any lower level code.

    You are right though that a mix of high level and low level languages tends to give the best result in the lowest amount of time. What has shocked me is that from experience I have seen that pure c/c++ apps are almost always faster when redone in python even without anything outside the standard library. C/C++ show up very fast in these micro optimization benchmarks. However I have not seen them show up that fast on large codebases. Probably because it takes so much time and effort to optimize them. So while those apps could be made faster then the python versions it would cost too much money to do it since the code base is so large. This is an even better reason that that hybrid stuff pays off so well. The low level parts are so small that you can highly optimize them and you will end up with an app a good deal faster then ANY c/c++ app of reasonable since you can afford to produce.

    --
    Computer modeling for biotech drug manufacturing is HARD! :)
  160. Re:Too bad... by shutdown+-p+now · · Score: 1
    In the case of Java, it's usually a matter of keeping heap allocations to a minimum.
    Since Java doesn't have anything analogous to C# value-types, everything ends up on the heap, whether you want it or not. I don't see how this can be avoided without coding in Java in essentially procedural style (static functions only etc). Untyped collections further aggravate the problem.
  161. The point being by Anonymous Coward · · Score: 0

    Python is easy to learn at a basic level. It is very easy to use for simple tasks.

    Python also has the features of modern, powerful, high level languages. I was not saying that Python had features that other languages didn't. Quite the opposite.

    At some point it became necessary that I could create cross-platform applications. The reason I selected Python, rather than Java, was a Slashdot article. The article had comments from a developer at Sun saying that Java was a lousy language for developing in their environment. One of the languages that he proposed as an alternative was Python.

  162. MOD PARENT UP nt by Anonymous Coward · · Score: 0

    ett ne

  163. Re:Python Zealots Are Like Slashdot Zealots by Anonymous Coward · · Score: 0

    I can't believe some idiot would mod my reply down while modding the other responses up, even though I was being just as honest in my opinion as they were. Obviously the guy is a Python zealot who doesn't want to hear an opinion he doesn't like.

    Python is a great language, so much better than Perl, but it isn't as great as python zealots keep preaching. It simply fails when compared to other tools in areas such as enterprise development, web development, etc.

  164. The real problem with Python by stmfreak · · Score: 0, Flamebait

    Just like Java before it, Python is the latest "answer to all our problems" in software development. I'm betting that we'll see another replacement within three years.

    But the real problem is that it seems the majority of developers will use any justification to use Python, no matter how thin. Once acheived, they begin their campaign of rewriting entire projects from whatever crappy, unmaintainable language we last used to whatever soon-to-be-crappy-and-unmaintainable new language they want to play with.

    This ongoing effort to move from old language to new seems to be driven by little else than a developer's desire to work with cool new stuff. It robs our businesses of tremendous productivity and makes it that much harder to succeed. I've seen bugs put off for years because they were in the old-language code and the developers didn't want to touch it until the major rewrite scheduled real-soon-now. I've seen perfectly good code bases thrown away with no justification given or some flimsy speculation that new language will be better/faster/more.

    It is this campaign to use new languages that robs businesses of huge amounts of productivity. Not merely the effort to rewrite stable code with new code in new languages, but the effort to test it, the effort to find and fix bugs. The effort to achieve the previous code's stability with multiple cycles going from 0.0 to 3.0+ over the course of years.

    So if you're looking at Python or some new language as an interesting way to do your type of software development work, please consider how much further your business could advance if you just train your current development staff and new hires in whatever language you are already using.

    --
    These opinions guaranteed or your money back.
  165. Obligatory whitespace comment by LuckyStarr · · Score: 1

    Q: My program wont run!
    A: Reconfigure your editor!

    --
    Meme of the day: I browse "Disable Sigs: Checked". So should you.
  166. Python lover wrote the article by Anonymous Coward · · Score: 0

    Nobody mentions that the person who wrote the article is hyping python. He is a python lover.

  167. Lint by Safety+Cap · · Score: 1
    The formatting requirement helps to ensure that your code isn't a disgusting mess that no one can figure out, YMMV.
    You better make that: YMWVAL (your mileage WILL vary a lot).

    In mature coding shops, all code is automatically run through a lint engine before it is compiled. It doesn't matter what the religious arguments one might have about where the brackets go, how many spaces between parens, etc., because when you hit the "compile" button, it all gets replaced by the corporate standard.

    The net bonus is that one can concentrate on making the program work, rather than worrying about tabbing/spacing/bracketing in the right place. In fact, whenever I've worked in a non-mature shop, it is always a pain, because I have to remember to do all that stuff. Using a LINTer is so much easier.

    Since you appear to be unaware of formating your code with lint, please at least tell me that you use source control.

    --
    Yeah, right.
    1. Re:Lint by Anonymous Coward · · Score: 0

      lint didn't reformat source, it just offered some warnings that hadn't been implemented in most compilers at the time. What you're using sounds more like cgrind.

    2. Re:Lint by k8to · · Score: 1

      Tools like cindent are a nice idea, although I've always found that they're unable to incorporate a sufficient amount of C formatting intelligence to match what a well trained editor and programmer staff can do. The C formatting at Wind River where we had an actual formatting standard that people followed (and emacs and vim and etc modes passed around to support it) was definitely superior to the layout I've gotten from autoformatting shops.

      The brackets are more than just inconsistency, though. They're noise. If you regularize them by hook or crook, they're more ignorable noise, but they're still on the screen. Indentation flow removes the noise so you have more code per line without unnecessary noise.

      --
      -josh
  168. Re:Too bad... by LWATCDR · · Score: 1

    "for God's sake, rewrite the application in a real language."
    Why and what do you mean by a real language? I knew people that feel anything less than assembly is not real language. c and c++ are for those armatures that can not write assembly language. c is slower and a lot more bloated than hand optimized assembly. Sound s just like the anti java nuts. I we use several apps written in java where I work. They work well and respond fast enough. The users never have to wait on the program. They also run on Linux as well as Windows. So why should we spend time and money to rewrite the applications in a "real language"? What would we gain? If a program is fast enough that you never wait for it, never crashes, and gets the job done then the programmer did a good job.

    --
    See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
  169. Re:Perl is run by a Christian. by the_greywolf · · Score: 2, Insightful

    i don't get you.

    why? why does that matter? why should i care whether Alan Turing was gay? why does it matter what religion or faith Larry Wall may or may not follow?

    --
    grey wolf
    LET FORTRAN DIE!
  170. Yet again by blackhedd · · Score: 1

    If you really hate the whitespace thing, then use Ruby. You haven't argued against the basic dynamic-language proposition, just against one of the (arguably minor) features of Python.

    1. Re:Yet again by shutdown+-p+now · · Score: 1
      If you really hate the whitespace thing, then use Ruby
      That's exactly what I do. I just wanted to point out that Python is not a good, well-designed language, as some people try to portray it (and push it).
  171. You have no point. by Anonymous Coward · · Score: 0

    Python is no easier to learn at a basic level than comparable languages like perl, pike and ruby. All of which are just as cross platform, just as easy, and more feature complete compared to python. Just because you are used to VB, doesn't mean python is good. It just means VB is bad.

  172. Re:Too bad... by ArbitraryConstant · · Score: 1

    Just because everything is on the heap doesn't mean you can't reduce allocations.

    Littering memory with temporary objects makes a lot of work for the garbage collector. If that can be reduced, there are significant performance advantages. For example, javax.swing.JComponent.getLocation() takes a Point object as an argument, so it can setup the provided object rather than allocating a new one.

    If you can set up your classes to recycle objects like that, you can reduce the allocations and therefore reduce the work for the garbage collector. You can get very close to C++ performance if you put a little time and care into it, and it's still way easier than dealing with C++ because you don't have to achieve perfection with your memory management. You just have to recycle the most commonly used objects.

    --
    I rarely criticize things I don't care about.
  173. Story Title by RobertKozak · · Score: 1



    When I first read it I thought maybe Jonathan Archer got a new pet.
    Then I wondered, did he get rid of the dog or did the new snake just eat him?

    --
    Bet this .sig looks familiar.
  174. Finding a good general purpose language is hard! by Anonymous+Brave+Guy · · Score: 2, Interesting
    I do not like C++ as a language though. C's use can be justified for low-end systems, but C++ is in more of a quandary, since its architecture has been superceded by newer languages

    The problem is that actually, it hasn't, although it surely should have been a long, long time ago. Alas, the bulk of the software development industry is so driven by marketing hype and buzzwords that it has collectively failed to develop a new language that is a serious choice as a general purpose programming language spanning many problem domains.

    A lot of newer languages imitate C++'s approach in terms of design tools, most obviously Java, C# and now Visual basic.Net. However, the beauty is only skin-deep; these languages often lack the solid, underlying framework and reasoned design decisions that have gone into C++, with the result that most of the time they are lucky to be as good, never mind an improvement. The addition of generics to Java several years later is an obvious demonstration of what happens when you go for buzzwords and you meet someone who went for solid design principles.

    Many other languages have something valuable to offer developers, but then go and spoil it in some other way, ultimately winding up with something that might fit certain niches, but isn't suitable for major development projects across a wide range of areas. Some common examples come immediately to mind:

    Java Pro: emphasises safety, readability, and portability; con: sacrifices low-level control (and with it performance) and only supports a limited number of programming techniques, encouraging over-engineered, component-based designs Perl Pro: quick, flexible, useful for rapid development of useful tools; con: terrible scalability and unfriendly (to both programmers and tools) syntax restrict it almost exclusively to quick-and-dirty projects Haskell Pro: elegant and powerful syntax, serious support for powerful programming tools like higher-order functions; con: overly academic community, and puts purity above pragmatism, making it hard to use in real-world projects where things like UIs are involved

    The list goes on, but the important point is that while each of these has good applications, they all have obvious flaws as well. Java is the closest to a serious general purpose language, but even today most of the serious Java code is restricted to server-side back-ends driving databases or some thinly disguised variant on that theme.

    C++, for all its sins, remains a pragmatic, balanced choice for a general purpose language that can be effectively adapted to a diverse range of applications. Is it a perfect language? Of course not. It has gaping flaws in any number of areas. The problem is that no-one has yet produced an alternative that beats it on all of them without significant compensating weaknesses.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  175. Missing the point by Anonymous+Brave+Guy · · Score: 1

    You're debating which language is better based on whether a one-liner takes 9 lines or 12 to code?! If it were that easy, we'd all go back to writing in BASIC.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  176. Re:Finding a good general purpose language is hard by zootm · · Score: 2, Insightful

    I'm not convinced that Java, as an example, is a worse general choice than C++ (I'd assert that as often, or more often, than C++ is a good choice, Java would be a good choice, but that's obviously not really fairly decidable). You're right that everything has pros and cons, I just feel that C++'s cons began to outweigh its pros a while back, and it just seems more evident today.

    I'm also extremely unconvinced that any of the languages you mention have less "reasoned design decisions" than C++. The advantage of these newer languages is that their programming is, in general, more "safe" than predecessors like C++ -- although none of them are a true "general" language (what is?), a competent coder should be able to pick up the one most suited to his or her project and use it, without fear of having to learn a whole load of coding rules to avoid buffer overruns and the like.

    Although C++ can be a reasoned choice sometimes, I do not see it as useful for new projects in a lot of areas. For most purposes, there's a better choice. But that's simply my opinion, of course.

  177. Too verbose? by Anonymous+Brave+Guy · · Score: 1

    Well, you've repeated the same entire expression twice in just one line of code. Moreover, the syntax contains redundant elements even without that. That's hideously verbose compared to, say,

    myFile = open "Some file Name";
    File myFile("Some file Name");
    open(MYFILE, ">Some file Name");

    or any number of similarly concise and more readable variations in other languages.

    Really, if you're going to support Java, you shouldn't have argued in favour of one of its worst attributes! :-p

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  178. Is this a joke? by Anonymous Coward · · Score: 0

    The project is a network server application. What code gets executed depends on what commands the client sends to the server. Conditional execution is very common, they added handy things like "if" and "else" because its so handy in fact. You should try it sometime, it really makes things much easier.

    I assume you mean that I should waste time writing tests that verify what the language should be verifying? Things like is my string a string? That's an awfully backwards way of thinking. Rather than spending more time working around a languages limitations, I would prefer a language that doesn't stick me with such limitations in the first place. If you don't mind having to work around limitations like this that's up to you, but not everyone is going to be horny for python and ignore its faults. I don't consider languages like religions, so I am perfectly willing to switch to a language that solves the problems python has.

    Saying "ruby doesn't support threads" in response to my statement that "ruby doesn't support threads" seems somewhat disingenious. I know ruby has a broken, pretend threading implimentation within the interpreter. Like I said, its not a show stopper, but I would certainly give more points to languages that impliment threads correctly. We made end up needing to use an SMP machine at some point, and working around ruby's limitations isn't any more appealing than working around python's limitations.

    And finally, there's no way I would write this in java because I value my time, and java is not portable. We're using openbsd/amd64 because this is a security sensitive application that has been actively targetted by "hackers", likely being paid by the company we're making angry. There is no java on openbsd/amd64. There is python, ruby, perl and pike though. Python doesn't compete with java for me, java isn't even an option. Python does compete with ruby, perl and pike though, which are all very similar languages that are all similarly productive. We will continue to evaluate those 3 languages, and then move to whichever one solves more of the problems with have with python, while adding the least number of problems of its own.

    My question is, why do you have such a strong desire to try to make me believe that python's faults don't exist? Every language has its downsides, I am not going to ignore them and use python just because you can't fathom the benefits of static typing.

  179. Is premature reusability the root of all evil? by Anonymous+Brave+Guy · · Score: 1
    Many programmers like to whip something out now. A quick "one off". Instead, often, with a little more time and more ground work, they can make something that is reusable.

    We should change the Fundamental Law of Software Development to "premature attempts at reusability are the root of all evil".

    If it takes you five lines of code and seven abstractions just to read a value from an input stream, just because you can then share a couple of those abstractions across different types of value, is that really more readable, maintainable or efficient than simply writing one-liner versions to deal with different input types?

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    1. Re:Is premature reusability the root of all evil? by Anonymous Coward · · Score: 1, Insightful

      Yes, because it's doing more than just reading values from an input stream.

      In short: Java isn't a languaged designed to make Hello Worlds.

    2. Re:Is premature reusability the root of all evil? by Anonymous+Brave+Guy · · Score: 1
      Yes, because it's doing more than just reading values from an input stream.

      But what if, as is often the case, reading a value from an input stream is all I want to do?

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  180. Re:Python is dead, long live Ruby! by Anonymous Coward · · Score: 0

    Python can't hold a candle to the elegance of Ruby.

  181. Web programming in Python by akaempf · · Score: 1

    Python is excellent for web programming, thanks to a number of frameworks. Zope is the best known, but I much prefer SkunkWeb (http://www.skunkweb.org), which is simple to use and (in my experience, having spent a lot of time trying to get Zope to do things) more flexible. It's also very fast. There is also webware, cherrypy, and others. All these frameworks make it easy to access form fields, manage cookies, build up pages from components, access databases, and use Python to generate dynamic content.

  182. Let me try this another way... by blackhedd · · Score: 1

    Since Java is unavailable to you because of your platform choice, why not consider C++? (I'm currently supporting a 300,000 line C++ app written on OpenBSD, so I know it works pretty well.)

    I'm trying to find out if, in your view, the use of dynamic languages for enterprise applications is a good thing or not. I hold no particular brief for Python (I prefer Ruby).

  183. Re:Too bad... by tyrantnine · · Score: 1

    Another poster already made a clarification on this. I didn't "mis-speak" I was just a bit obscure with my meaning. Point being, if you code in C/C++ you'll spend a lot of time making the program work correctly. If you write in eg Java or Python you can get the program working correctly in a fraction of the time. This means you can add polish or move on to new stuff.

    These statements about programming productivity given X language spouted as truisms still make me grind my teeth. I've spent most of my time programming in C++ and Java. After gaining a good bit of experience with Java, I awaited the epiphany that I was suddenly experiencing a boost in productivity coding in Java. This never happened. My experience in dealing with other professional developers (the company I am currently with employs 80+) is that most with significant experience in both worlds share this opinion. The languages are simply not that far apart on the language tree. Java's "out of the box" libraries dwarf the STL, but it is not as if its difficult to find mature C++ libraries (QT, ACE, BOOST, etc) which cover the bases and provide a cross-platform framework. The level of depth is simply not that wide - nothing like ASM->C. Does anyone really feel writing a complex swing GUI is more efficient than a similar QT one? Back in the day, the lack of templates was a checkmark in the Java win column for "simplicity and productivity". So here we are now with Generic's in Java's latest incantation, along with our old friends enum and printf. It also always amazed me when operator overloading was touted as some highly confusing mess that Java managed to avoid -- when page 3 or so of any Java book has you concatenating strings using +. If anything, Java and C++ continue to grow more similar and this trend is only bound to continue. The popularity of Java has in no small way influenced the thinking and proposals for the impending C++0x standard.

    During my time at the university I had a couple professors who were large fans of functional programming. If anything this argument is far more interesting to me as it involves an entirely different programming paradigm (whereas Java and C++ are both "OOP" languages, with extremely similar syntax). LISP has been a garbage collected language since the 60s. However functional programming continues to dodge any real mainstream acceptance.

    First off, I'm willing to bet that virtually none of the little apps you currently have running are written in Java/Python whatnot. A sloppy coder can leak memeory in any language. (In fact I'd say it's a lot easier to leak memory in a language without a GC.) So moving to C/C++ doesn't really fix the memory issue.

    Yes, it is obviously easier to leak memory in a non-GC language. However, your implication that memory management in a non-GC language is so difficult (and leaks so prevalent) equalizes the greater memory footprint of a GC language is a little baffling. It's simply not that difficult, particularly with the maturity of memory checking toolkits and a variety of well developed smart pointer libraries.

    Regarding your comments about performance, let me point you to some interesting comments in "One Half a Manifesto" by Jaron Lanier...
    "If anything, there's a reverse Moore's Law observable in software: As processors become faster and memory becomes cheaper, software becomes correspondingly slower and more bloated, using up all available resources...

    One part of the answer is fundamental. It turns out that when programs and datasets get bigger (and increasing storage and transmission capacities are driven by the same processes that drive Moore's exponential speedup), internal computational overhead often increases at a worse-than-linear rate. This is because of some nasty mathematical facts of life regarding algorithms. Making a problem twice as large usually makes it take a lot more than twice as long to solve. Some algorithms are worse in this way than others, and one aspect of getting a solid underg

  184. Why some recursions are better than others by Anonymous+Brave+Guy · · Score: 1
    How is testing say, a recursive-descent parser, going to be a more valid test of recursion than a recursive solution for fibonacci numbers?

    Because using recursion to calculate Fibonacci in the obvious way is a hideously inefficient algorithm. In languages designed to support recursive programming styles, such as most functional programming languages, this will be dealt with. In low-level languages like C, it won't, but then in C you would never implement the algorithm that way in the first place. It's not a fair test of the ability to implement a real world algorithm efficiently in different programming languages, which is the only useful metric you're going to get out of that sort of test set-up.

    Compare this with a divide-and-conquer algorithm like quicksort, or an algorithm over a recursive data structure like an insertion on a binary tree, where the use of recursion to implement the algorithm is natural and need not introduce these arbitrary overheads.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    1. Re:Why some recursions are better than others by Wavicle · · Score: 1

      Because using recursion to calculate Fibonacci in the obvious way is a hideously inefficient algorithm.

      The algorithm efficiency was NOT being tested. Recursion performance was being tested. How is using recursion for fibonacci not a valid test of recursion?

      It's not a fair test of the ability to implement a real world algorithm efficiently in different programming languages, which is the only useful metric you're going to get out of that sort of test set-up.

      No, that is incorrect. What is being tested here is how efficiently the language handles recursion.

      Compare this with a divide-and-conquer algorithm like quicksort, or an algorithm over a recursive data structure like an insertion on a binary tree, where the use of recursion to implement the algorithm is natural and need not introduce these arbitrary overheads.

      Both of those algorithms are highly sensitive to memory access latency, cache size, caching strategy, etc.. The memory access could easily become the dominant use of time. The question being asked with the fibonacci problem is "how well does the language handle recursion." This is not the best way to calculate a fibonacci number, but it is a very good way to test recursion-dependent issues such as stack frame usage without muddying the results with a large amount of calculations or random memory access.

      --
      Education is a better safeguard of liberty than a standing army.
      Edward Everett (1794 - 1865)
    2. Re:Why some recursions are better than others by Anonymous+Brave+Guy · · Score: 1
      What is being tested here is how efficiently the language handles recursion.

      OK, if that's your take on it, then yes, of course C is "slower" at dealing with recursion than languages designed to pick up lots of optimisations in recursive code. Whether this is actually a useful comparison to do if you're considering which is the more useful programming language is a different question.

      Both [quicksort and insertion into a binary tree] are highly sensitive to memory access latency, cache size, caching strategy, etc.

      I'm not entirely convinced that's true, unless either you have a language where the implementation of data structures really sucks or you're working with data sets so small that algorithmic performance isn't really an issue. I write high performance mathematical algorithms, many of them operating over very large graph-like data structures, for a living, BTW. I'm more than a little familiar with profiling this type of code and identifying the performance bottlenecks, on something like 20 different compiler/OS/hardware combinations.

      In any case, these are considerably more realistic comparisons to make between programming languages, since it's likely that in practice a programmer would actually implement the same basic recursive algorithm in both languages.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  185. Re:Too bad... by dubious9 · · Score: 1

    "I'd include using an old-fashioned language like C or C++ in a system which does not require huge speed or efficiency"

    I'd like to say that it's not only speed or efficient requirements for C or C++, but for legacy needs as well. One could probably make the argument that more legacy development is done than new speed-dependent code. Last time I wrote C was to interface with a FORTRAN backend. We didn't have the time or money to rewrite 200K+ LOC, nor spend time validating "new" compilers. C was the most logical and quickest choice here.

    Main point is that C/C++ have many applications in which they would be used, not just for the sake of speed/efficiency.

    --
    Why, o why must the sky fall when I've learned to fly?
  186. Use a Phaser by AvatarofVirgo · · Score: 0

    How many Starfleet Officers does it take to shoot a Python in the Enterprise... Wait wrong article.

  187. Re:Too bad... by zootm · · Score: 1

    Yeah, I should've made that more explicit in the post (some of the other posts I've made around this thread have said this more clearly).

  188. Nope. by Anonymous Coward · · Score: 0

    I would rather go all the way and use C, I am not a big fan of C++ at all. However, this choice has nothing to do with dynamic vs static languages. Like I said, we are evaluating pike (specifically, I am doing the test rewrite in pike) which is statically typed and catches errors like the one I pointed out, yet its just as high level and fast to develop in as python. It doesn't have to be a choice between low level static and high level dynamic, high level static languages exist too.

    You are making a big mistake here in assuming that dynamically typed languages offer a development speed benefit over statically typed languages. I can understand why you would think that if you compare working in java to working in python, but try comparing python and pike, and suddenly you'll see that you can have static typing, and fast development speed.

    What I am saying is high level, object oriented, interpreted languages are good, and I don't see any reason they can't be useful in an enterprise environment. But they don't have to be dynamically typed, they can and should be statically typed.

  189. Re:Too bad... by Anonymous Coward · · Score: 0

    > 4) Cost to get software running "right" - $25,000. Cost to upgrade the server to a dual proc - $1,500. Which are YOU going to do?

    I'd spend $27,500 and make it 4 times better.

  190. Zope's website horribly broken by Anonymous Coward · · Score: 0
    Looks like they really need help too, considering how aweful their website is.

    See that "About Us, Products, Services, etc" menu at the top? I moved my mouse to "products," which automatically popped up a menu with "About Zope", "Zope4Intranets", etc. Then I highlighted "About Zope" and right-clicked, assuming my browser would show me a menu that would let me open that page in a tab while keeping the careers page open.

    It didn't work.

    Because it's not a hyperlink.

    That whole top menu is some weird Javascript construction. 2005, and they don't even know how to use hyperlinks on a website yet.

    Please, somebody with even modest familiarity with the web, go help these people.

    1. Re:Zope's website horribly broken by 3.2.3 · · Score: 1

      Ah. You went to zope.com.

      Go to http://zope.org. You will find nary a drop down menu there.

  191. Another example... by sirReal.83. · · Score: 1

    Don't forget that Red Hat has been using Python extensively in its Enterprise Linux releases for years now. Stuff like the system-config tools and... the installer. :)

  192. Re:Too bad... by shutdown+-p+now · · Score: 1
    Littering memory with temporary objects makes a lot of work for the garbage collector. If that can be reduced, there are significant performance advantages. For example, javax.swing.JComponent.getLocation() takes a Point object as an argument, so it can setup the provided object rather than allocating a new one.
    I always thought one of the points of having a GC is that you can use the 'callee allocates' approach rather than 'caller allocates' (as seen in C), thus allowing one to allocate and return strings and such as needed, without requiring the caller to do that job. With what you suggest, what's the difference between Java code and C code then? what's the point in having the GC? getLocation(Point) looks close enough to something like gets(char*) to be unnerving.
  193. Re:Perl is run by a Christian. by Anonymous Coward · · Score: 1, Insightful

    Wall isn't like that. He's somehow retained his mental agility and rejects the idea that you should code the same way he would.

  194. Lay off Porthos! by fm6 · · Score: 1

    He's the only believable character on the show!

  195. Python on the NX-01 by D4C5CE · · Score: 2, Funny

    Then again, shouldn't we all be truly worried for Porthos?

  196. You are seriously confused. by Anonymous Coward · · Score: 0

    There is nothing wrong with having a variable be a function, and he's not saying that should be a syntax error, or that he can't think of a reason for it. The point is that static typing catches errors that arise when you set a variable you *thought* was a string to be a function. It doesn't stop you from making a variable be a function if you want it to. You just have to want it to, instead of doing it by accident.

    See, in pike it would go like this:
    string var = obj->method(); // var is the string returned by obj->method()
    function var = obj->method; // var is obj->method(), you can now call var()

    if you do:
    string var = obj->method;
    you will get an immediate syntax error, just like if you do:
    function var = obj->method();
    (assuming obj->method() doesn't return a function of course).

  197. Re:Too bad... by napir · · Score: 0

    Object reuse usually doesn't reduce the load on the garbage collector on modern systems. On the contrary, it may increase the load. This is because modern generational collectors are optimized for reclaiming short-lived objects. Most collectors pay no cost at all for reclaiming them. Reusing objects creates longer-lived objects, which add to the cost of every GC during their lifetime.

  198. Submit it. by sleepingsquirrel · · Score: 1

    You can submit your faster programs here

  199. Re:Too bad... by ArbitraryConstant · · Score: 1

    "With what you suggest, what's the difference between Java code and C code then?"

    The structure of Java makes it easier to deal with large projects as compared to C, and it's less of a minefield than C++.

    "what's the point in having the GC? getLocation(Point) looks close enough to something like gets(char*) to be unnerving."

    Well yeah. It's basically the same thing. Except it doesn't have a buffer overflow vulnerability.

    The point is that you can pass things around without worrying so much about who has one (though of course you still do have to worry for thread safety). In C/C++, you have to take very special care if you want to pass anything that's been allocated around, make sure it has a refcount, etc.

    Also, you don't need to do it all the time, just catch the cases that happen a lot. It's usually not that hard to provide two altneratives of a function, where one allocates the object and the other takes it as an argument. It's an optimization, it's optional, and it's damned easy to use. Another example is the use of StringBuffers instead of Strings when you need to concatinate them. Strings are immutable, so it has to do a copy every time you cat two strings, and the old copy is lost.

    We'd all like to believe garbage collection were free, but it's not. If we can take a bit of the work away, it's a lot less expensive. We can still use it though.

    I actually prefer Python and C to Java, but Java does have its uses.

    --
    I rarely criticize things I don't care about.
  200. Wow, thank you by goombah99 · · Score: 1
    Thank you for the execellent insights and tips. I had timed a bunch of different ways to increment the hash variables but had not tried putting the exception trap in the loop assuming that would be hideous in speed (just a bit hideous in readabiliy if things get nested).

    As for the 'magic' of in-place or not in-place I dont see that as magic. Indeed this is something that garbage collecting object oriented languages should strive for. For example, java and i'd bet python makes every effort to re-use allocated object space from garbage collected objects rather than creating new ones as they are instantiated. This is essentially no different than the program deciding to do a sort in-place because it can. It's analogous to the lstrip being space efficeint on imuatables.

    That is by hiding the implementation you are free to do exactly this sort of magic under the hood. From the user's perspective it would be no hardship if sort() always appeared to return the sort as a value. It could be secretly in-inplace due to the Garbage collection of the original memeber when writing a=a.sort().

    So __slots__ is analogous to perl psuedoarrays I gather where keys become enumerables. In some ways I wish you would hide all that from the user so that even more efficient access could be implemented down the road. One could Grant back the low-level under-ther-hood access to object functionality with a forma introspection method rather than allow primitive access to the details to the object itself. (ala java) Afterall how often does one need to fiddle with the objects method list manually? exposing this structure freezes the implementation. This is one place where python could make its greatest perfromance enhancement over perl I would think.

    Anyhow thank you for your intelligent comments.

    --
    Some drink at the fountain of knowledge. Others just gargle.
  201. Re:Too bad... by shutdown+-p+now · · Score: 1

    I would still prefer the Eiffel approach to that. Frankly, I never understood why Java doesn't have any means to store objects on the stack (apart from perceived simplicity). The powerful 'expanded' modifier in Eiffel, or at least value-types in C#, are really useful.

  202. Re:Too bad... by ArbitraryConstant · · Score: 1

    No denying that.

    I'm not saying Java is perfect, but the performance is generally good enough for something else to decide which language to use.

    --
    I rarely criticize things I don't care about.
  203. Re:look beyond whitespace to truely appreciate Pyt by vidarh · · Score: 1
    It isn't a trivial issue. Look at how the whole paranthesis thing has coloured peoples perceptions of LISP and Scheme over the years, for instance. The reason is that syntax matters. Syntax has a profound effect on how people work with a language. Programming isn't only about the structure of the code but also about the visual presentation of the code - many of us are strong visual thinkers.

    I know from experience that syntax I don't like slows me down. I'd rather write more lines in a syntax I'm comfortable with than fewer in a syntax I find painful and annoying to work with.

    You're coloured by a particular way of thinking - so whitespace is "trivial" for you. Good for you. It's not for me - or more precisely, the lack of explicit non-whitespace block markers is not trivial for me.

    Unconventional semantics doesn't bother me. A syntax I don't like will make me stay far away from a language regarding of semantic properties.

  204. Programming is Work by rocker_wannabe · · Score: 1

    If programming isn't painful then you aren't doing it right. Nothing scares me more than a programmer that still thinks programming is fun. It means they probably either haven't had a customer for their code or they left before their bugs caught up with them.

    --
    "Meaningless!, Meaningless!" says the Teacher. "Utterly meaningless!"
  205. Re:Too bad... by jadavis · · Score: 1

    I'm sorry, but the "but it's slow" argument does not hold for most software designed today. Let's please get over it.

    That's only if it's an interactive application with a reasonable response time. If a human is sitting in from of your app and your app is faster than the human, great.

    However, that doesn't work for any underlying software. As processors get faster, software engineers are using increasing degrees of abstraction as a tool. If you're working on one of the lower layers, it better be fast, or else everything on top is going to compound the performance problems.

    Operating systems have to be fast, file systems have to be fast, databases have to be fast, http servers have to be fast, web services servers (e.g. SOAP servers) have to be fast, code libraries have to be fast, interpreters have to be fast. Once all those things are fast, you can make the final, end-user app pretty slow and it will still be so fast the user won't know the difference.

    However, even that can be a little deceptive. You have to avoid major algorithmic problems. You have to understand all the layers you're building on, otherwise you will misuse some abstracted library and it could perform much more poorly than you expect (even if you follow the documented spec). The more abstractions you rely upon, the easier it is to do that.

    Oh yeah, and processors are not improving so much in serial processing as parallel processing. So if your algorithm can't be easily parallelized, you might have a problem even if you spend infinite money on processors.

    So, performance will always matter to programmers unless they are really just designing an interface by clicking and dragging in VS.Net. Or maybe if projects stop becoming more complex, which is unlikely to happen.

    --
    Social scientists are inspired by theories; scientists are humbled by facts.
  206. Re:Too bad... by ShinmaWa · · Score: 1

    You had me right up until you wrote this:

    Another example is the use of StringBuffers instead of Strings when you need to concatinate them. Strings are immutable, so it has to do a copy every time you cat two strings, and the old copy is lost.

    In reality, nearly every Java compiler since 1.2.1 will optimize for this and will auto-generate StringBuffers on the fly if you concat two Strings.

    --
    The /. Effect: Thousands of users simultaneously accessing a site to not read its content.
  207. Re:Too bad... by zootm · · Score: 1
    Operating systems have to be fast, file systems have to be fast, databases have to be fast, http servers have to be fast, web services servers (e.g. SOAP servers) have to be fast, code libraries have to be fast, interpreters have to be fast. Once all those things are fast, you can make the final, end-user app pretty slow and it will still be so fast the user won't know the difference.
    These are mainly either systems which already exist in a fast and stable form, or "language features" which are more likely to be present in newer languages (rather than having to track down a library or reimplement yourself).

    As for algorithmic problems, this isn't really relevant to the point of which language one is using (I'm not sure if you're even trying to argue that?), other than the fact that a language with well-implemented utility libraries is likely to have used as good or better an algorithm to yours.

    My post was about programming languages, not programming style, in any case.
  208. Re:Too bad... by ArbitraryConstant · · Score: 1
    while (foo.hasNext()) {
    outputString = outputString + foo.next();
    }
    --
    I rarely criticize things I don't care about.
  209. Begin the "typing" holy wars.... by Tablizer · · Score: 1

    It's good to have languages that are not type checked, and it's good to have languages that are. The former is better with smaller groups, smaller programs, or more proficient developers. The latter is better with larger groups working on larger programs with more apprentices on the team. The former allows more flexibility and speed. The latter offers more imposed speed limits (and less car crashes).

    Why is dynamic or loose typing allegedly bad for "large" projects? I keep reading this claim from Java fans, but have never seen a clearly described/coded scenario. Can anyone give a specific example?

  210. Re:Finding a good general purpose language is hard by Anonymous+Brave+Guy · · Score: 2, Insightful
    You're right that everything has pros and cons, I just feel that C++'s cons began to outweigh its pros a while back, and it just seems more evident today.

    It all depends on your application domain. For applications that are predominantly UI/database driven, as obviously many are, C++ has few advantages over something like Java. However, in anything scientific (where performance is often paramount) or in huge markets like embedded or instrument-control applications (where tight code and/or low-level control are often required), languages like C and C++ are still far ahead of the competition IME. Java is making some inroads into the embedded space, but it's barely a blip in the graph right now.

    I'm also extremely unconvinced that any of the languages you mention have less "reasoned design decisions" than C++.

    I think that's a little harsh. If there's one thing you can fairly say about C++, it's that Stroustrup and the standards committee take their time and try to reach good, practical decisions. It takes forever to make changes as a result, but with a few exceptions (the designed-by-committee string functionality, for example) the underlying design decisions of C++ are really very robust. Stroustrup's oft-cited book, The Design and Evolution of C++, provides some fascinating insights into how a serious computer scientist designs a language, and the factors that weigh into that decision. Even where I disagree with a decision that's been made, not that that often happens with this particular programming language, I can at least understand the rationale behind the decision.

    Compare this with Java's almost amateur development process, and the design weaknesses that have resulted. For ages, the Powers That Be dictated that generics/templates/whatever weren't useful, and wouldn't be included. Lo and behold, a few years later, they concede that they were wrong and retrofit them (but still in a feeble way that misses half the point and 90% of the power). More seriously, although Java has a vast standard library, much of it is a joke compared to the high-quality, often peer-reviewed work found in things like Boost, CPAN, and so on. For example, AWT was so bad they had to invent Swing, and that's still not a patch on serious GUI libraries like Qt or wxWidgets in their various forms.

    In fairness, the less formal processes (a.k.a. benevolent dictatorships in most cases) that underlie many scripting languages (notably Perl and Python in relation to the current discussion) tend to be rather more flexible. Even so, how can a language that doesn't even have a specifcation apart from a compiler that its own author couldn't rewrite from scratch possibly be considered to have an industrial-strength design process? (That would be Perl, and indeed the reason for all the completely rewritten underlying mechanics for Perl 6.)

    The advantage of these newer languages is that their programming is, in general, more "safe" than predecessors like C++

    That is indeed a compelling advantage. C++ has always been written for "good programmers", the craftsmen who take their craft seriously enough to learn the details and avoid the obvious mistakes. Unfortunately most programmers aren't like that, and most companies are going to be employing "most programmers" most of the time. It is therefore a sensible management decision to go with technology that mitigates "most programmer" errors.

    The only problem is that sometimes, you actually need finer control (and to accept the attendant risks) in order to get a good result, and if you need to hire some geeks to use that control, so be it. If you have a language that actually won't let them bend or even outright break the rules when they know damn well that it is safe to break them in the particular circumstances they're working under, then that's a serious liability to some kinds of project. If you're going to fall back on linking to C functions, using JNI, or whatever every time you need performance, you might as well write in a language like C++ in the first place, and just hire enough good people to write safe, high-performance wrappers for the low-level code...

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  211. I/O in lazy languages by Anonymous+Brave+Guy · · Score: 1
    Now try to describe how basic I/O operations work in Haskell to a non-PhD.

    I can't see your problem. We just use the normal side-effects to communicate with the outside world, and... Oh, did you say Haskell was lazy? You did? Oh, dear.

    Seriously, monads aren't such a difficult concept if you're familiar with the basics of functional programming already. The main argument against them is similar to those often used against "design patterns" for OO languages: they get the job done, but other languages can do it all so much more neatly that they seem like a pointless over-complication to anyone who's used to the languages with native support for the feature. Forcing that level of over-complication to maintain conceptual purity or to permit occasionally elegant techniques like lazy evaluation is fine in academia, but a dead end in the real world.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  212. Re:look beyond whitespace to truely appreciate Pyt by tungwaiyip · · Score: 1

    What Python requires you to do is basically indent you code neatly. Which is what a good programmer is doing already. If you take a good Java program and remove the curly braces it is what a Python program looks like. So I really don't see why it can be a non-trivial issue.

    Do you have any representative example in which Python's syntax cause you grieve?

    I know what you are saying that some language's syntax can be annoying. Coming from a C background Pascal's := often got me. VB has lot more idiosyncrasy that often drive me crazy. In anycase it does not stop me from cranking out many lines of code. Python's white space syntax is very minor compares to the above cases as it is what we are practicing everyday. I never find any urging need to format my source code wildly.

  213. actually... by Anonymous Coward · · Score: 0

    according to the parent post, Perl does not even do that: $ is either a variable or a reference, so both would work fine on the left side.

  214. Python is weird by Anonymous Coward · · Score: 0
    This
    is
    a
    really
    good
    thing.
    Or not.
  215. Why are you arguing? by Some+Random+Username · · Score: 1

    You are saying that indentation is good. Ok, so go ahead and indent. That doesn't explain why curly braces have to be removed. What else people want is the ability to have the clear, consise and useful curly braces that they have come to love. Instead of trying to dismiss the valid concerns about whitespace, how about trying to explain what benefit it provides? Saying "its just like what you are already used to" is a cop-out, that's not a benefit. And "it forces you to indent correctly" isn't even correct, as you can clearly have lines that look identically indented, but aren't actually being interpreted that way by python due to a mix of spaces and tabs. At some point you will have to accept the fact that you cannot convince people to give up something they like and find useful, in exchange for nothing. Provide some valid reasons why significant whitespace is good. If they best you can do is "its not that bad really, you'll get used to it", then its clearly a bad thing, not a feature.

    1. Re:Why are you arguing? by asdfghjklqwertyuiop · · Score: 1

      What else people want is the ability to have the clear, consise and useful curly braces that they have come to love. Instead of trying to dismiss the valid concerns about whitespace, how about trying to explain what benefit it provides? Saying "its just like what you are already used to" is a cop-out, that's not a benefit.


      Ok, well let me put it this way: Unless you are writing an obfuscated code contest entry, the curly braces are redundant. You're already indenting code the way python interprets it. You have been for years. I don't know if it provides any tangible benefits, but my point is that it shouldn't be a valid reason for not trying python. It really isn't the huge deal that many people make it out to be.


      And "it forces you to indent correctly" isn't even correct, as you can clearly have lines that look identically indented, but aren't actually being interpreted that way by python due to a mix of spaces and tabs.


      Give me a block of python code that looks one way and is interpreted another. I'm not saying you're flat out wrong, but I played around with it for a bit and can't come up with such an example so I have my doubts...

  216. Are you trying to be obtuse? by Some+Random+Username · · Score: 1

    Yes, having to enforce someone elses coding standard that we don't like on ourselves is the entire problem. Languages with syntax allow us all to program as we please, then re-indent to the standard *we* choose for our project. That's the entire point.

    Try writing some unit tests? No, try not having to test things that should be dealt with by the language. That's the entire point being made. Statically typed languages find these bugs immediately, and you don't have to waste time testing if your variables are what you think they are, its already guarenteed for you. Just because you don't mind wasting your time, doesn't mean everyone feels the same way. Some people like having computers deal with boring crap for them.

    When people say "I don't like language X because it has these 2 problems", you stating those same problems again doesn't counter it and make things all good. If you like python go ahead and use it, but stop expecting everyone to put up with pythons problems just because you don't mind having to deal with them. Python loses points for having these problems, but it doesn't having anything on the other side giving it points that I've seen. I don't find python offers any benefits over perl, ruby or pike, but it definately has a couple downsides. So, we're going to switch to one of those other languages that doesn't go out of its way to try to make things difficult for us.

  217. seriously mistaken information. try is 24x slower by goombah99 · · Score: 2, Interesting
    I just tried your suggestion of using the try/except format. You are seriously mistaken if you think that is fast:

    I benched the two pieces of code: (note the slashdot ecode tag removes the proper indentation, but this should be obvious in context)

    #!/usr/bin/python
    a ={}
    c = 10000
    for i in xrange(c*10):
    b = i%c
    a[i] = 1+a.get(i,0)
    and then using your suggestion:

    #!/usr/bin/python
    a ={}
    c = 10000
    for i in xrange(c*10):
    b = i%c
    try:
    a[i] += 1
    except KeyError:
    a[i] = i

    timing these shows the try clause almoist QUADRUPLES the time: the first runs in 0.62 seconds and the latter runs in 2.4 seconds!!!

    Now here is the is the point I was making in my original post: if you try this without using the get its almost 6 times faster than using the .get format and 24 times faster than doing it with the try statement!!!!!!!

    To show this consider the following example: In this special problem we know ahead of time what the keys will be. In general we would probably not know this if we were say parsing a file. But since we know them its cheap to write a loop to initialize them first. then we dont have use the get() statement or the try. then we can see how much speed we are losing to the get() statement.

    #!/usr/bin/python
    a ={}
    c = 10000
    for i in xrange(c):
    a[i] = 0

    for i in xrange(c*10):
    b = i%c
    a[i] += 1
    this runs in 0.11 seconds. Which is about 24 times slower than using the try.

    your information about how to replace autointialization appears to be seriously mistaken.

    --
    Some drink at the fountain of knowledge. Others just gargle.
  218. Re: CPAN by Ian+Bicking · · Score: 1

    Re: CPAN -- a bunch of improvements for PyPI (the Python Package Index) were written during PyCon, which should go some length to making something like CPAN. It's hard to really say -- CPAN is actually just a very simplistic FTP site, with lots of tools built on top. So it's a very different design. But with just a little more work, and a lot more evangelism PyPI (a lot of Python programmers don't even know about it) should become very useful.

  219. no by Anonymous Coward · · Score: 0
    " according to the parent post, Perl does not even do that: $ is either a variable or a reference, so both would work fine on the left side."

    er..no that's not what I said. in perl if you want the function you have to prefix the name with a slash, otherwise the function is simply called.

  220. Re:Too bad... by Anonymous Coward · · Score: 0

    > It increases the development time of a project,
    > increases the code complexity, increases the
    > chances of runtime bugs, and increases the
    > potential severity of what bugs you do have.

    C or C++, right? How about C,C++,Assembly and other things that I have no clue about and therefore declare them complex! How else on earth someone can put C and C++ on the same shelve when speaking about something like "code complexity"?

    JFYI: C++ with STL (and Boost if you want so) is just as fast to develop in as most so-called loosly-typed scripting languages. And speed is here for you as well.

  221. Don't Fall For Premature Optimizations by Ian+Bicking · · Score: 1
    I almost never have problems with performance in Python, and I program in it exclusively. For those things where performance really matters -- e.g., image processing -- there are library written in C that are available from Python (and fairly easy to use) like PIL. There are lots of algorithms in Python itself that are extremely fast, like a great hashtable implementation (Python dictionaries) and sort algorithm.

    If it's really a problem, there are a myriad of solutions -- Numeric and numarray for lots of numbers, psyco for JIT optimizations, Pyrex for a Python-like syntax that compiles to C (and can be as fast as C if you use it correctly), and lots of other new options as well -- IronPython is supposed to be faster than CPython (the standard implementation), there's quite a bit of work on type inference, PyPy is working hard at compiling Python to fast C, Boost can inline C++ code... there's a huge number of options.

    I've never encountered someone who had to throw a project away because of performance issues in Python. Sometimes they have to change the design, move some small parts of C, make better use of other people's libraries, and always of course driven by profiling -- but that's the kind of refactoring that always happens in development. And for a very large number of applications it simply is never a problem.

  222. Re:Too bad... by masklinn · · Score: 1

    Uh, no, i hate it because i've coded in Java and hated it, but since i didn't code many things in Java before hating it (no big apps or anything really major) i don't consider myself "fluent" in Java.
    I know the basis, with a few hours on the Javadoc (which i'm even able to find ! Ain't I impressive) i'd probably be able to code something in Java, but i still don't like the language

    Is that clearer?

    --
    "The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
  223. Re:Too bad... by cakoose · · Score: 1
    Second, Java and Python are not necessarily slow. [...] In the case of Python, it's usually a matter of spending as much time as possible in a C library (even if that means you have to write the C library).

    That means Python is slow.

  224. Re:Too bad... by cakoose · · Score: 1
    Frankly, I never understood why Java doesn't have any means to store objects on the stack (apart from perceived simplicity).

    Having two types of allocations (and parameter passing semantics) makes things more complicated. It's simpler to think of all allocations being heap allocations. However, there are optimizations to automatically use the stack in some of the cases where it's safe (see escape analysis).

  225. great... by torrents · · Score: 1

    just what most companies need... "new" migration experts pushing widgets that nobody on staff knows how to use.. but hey it must be better, it's new.

    --
    Get your torrents...
  226. Too bad...High-level scaffolding. by Anonymous Coward · · Score: 0

    "Another poster already made a clarification on this. I didn't "mis-speak" I was just a bit obscure with my meaning. Point being, if you code in C/C++ you'll spend a lot of time making the program work correctly. If you write in eg Java or Python you can get the program working correctly in a fraction of the time. This means you can add polish or move on to new stuff."

    Already being discussed in comp.lang.forth The short is that most "higher-level" languages need lots of "scaffolding" to verify the code is correct.

  227. An enterprise language needs a steering comittee by Anonymous Coward · · Score: 0

    Without a proper steering comittee, made of independent bodies you can't consider a language "enterprise worthy". Take PHP for example - hobsons choice, "The Zend way, or the highway". Same goes for Perl, Python and Ruby - very few people are controlling the direction the language is taking. With Java, at least you have the JCP, JSRs etc - expert groups spend a great deal of time suggesting and revising APIs before they are finally democratically decided upon and implemented.

    Java works because of this, and because it has such a large and stable selection of standardised components.

    Just my $0.02

  228. Re:Too bad... by Anonymous+Brave+Guy · · Score: 1
    C/C++ show up very fast in these micro optimization benchmarks. However I have not seen them show up that fast on large codebases. Probably because it takes so much time and effort to optimize them.

    It sounds like you're basing that purely on your own experience. Perhaps you simply haven't encountered that much C and C++ code, or you know some particularly good Python programmers?

    Here's a more objective test for you: which languages underlie the vast majority of high-performance mathematical/scientific/engineering applications developed in the past decade? If you need a clue, look for software developer job ads from scientific companies. ;-)

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  229. Re:Too bad... by Hast · · Score: 1
    These statements about programming productivity given X language spouted as truisms still make me grind my teeth.

    Your points on this topic are valid. Specifically wrt comparing Java and C++.

    When it comes to comparing productivity in languages there are many diffrent variables. The three (I'm sure you can think of more) that IMHO differ a lot between C/C++, Java and Python are code compactness, code accuracy and libraries.

    Often parts of these are related, eg Python has a rather high code compactness and coupled with powerful standard libraries this means that very little code can do a lot.

    In my experience Java and C/C++ are about equal when it comes to code compactness. All are quite verbose languages, although you can do "hacks" in C/C++ which in Java requires a lot of type-casting. Scripting languages and eg Haskell as a functional language have much more compact code. This may translate to faster to write and easier to understand code. (In the case of eg Perl this isn't necessarily so. But that's more compact due to obscurity instead of clearness.)

    By code accuracy (not a very good name for it) I mean that the code works like you think it should. Issues that appear due to eg memory or runtime issues are detrimental to this. A language which make it easy to catch errors and handle them at compile time get high ratings in this area. It doesn't really have anything to do with logical errors in the code, if the coder has a poor understanding of the problem no language can help. This is an area where C/C++ suffers compared to eg Java. In my experience you spend a lot more time in C/C++ chasing down memory issues and runtime segfaults than in a GC language.

    Libraries are probably the most important part though. Good libraries can make you extremey productive as well as making the code easier to understand. In this aspect Java and scripting langages typically triumph over C/C++. Naturally STL, Boost etc are all work-arounds for this, but it takes a lot more knowledge for the coder to know about these than standard libraries. (The discussion is really about poor/normal coders after all.)

    However, your implication that memory management in a non-GC language is so difficult (and leaks so prevalent) equalizes the greater memory footprint of a GC language is a little baffling. It's simply not that difficult, particularly with the maturity of memory checking toolkits and a variety of well developed smart pointer libraries.

    True. But again, the discussion was not so competent or sloppy programmers and programs that run a long time.

    It turns out that when programs and datasets get bigger (and increasing storage and transmission capacities are driven by the same processes that drive Moore's exponential speedup), internal computational overhead often increases at a worse-than-linear rate
    Yes, naturally. Not many algorithms are less than O(n) when they operate on large datasets.

    The data is larger both because there is some "sloppyness" but also becuase the data is a lot more complex today than 10 years ago. Back then MP3's were really neat and the thought of having your computer chew through multi GB data like DVDs for processing were not very common.

    Bloat and complexity increases, but so does "useability".

    And you will find very few of game development houses dealing in Java!

    You find very few 3D engines coded in Java. But you also find that the majority of games today use internal scripting languages. These are often standard languages such as Java, Python or Lua.

    Right tool for the job. As another poster wrote, don't write everything in one language. And sloppy coding in C/C++ may very well turn out slower than a sloppy coding in eg Python.

    And yes I agree that C# and Java are very similar. I have never doubted that. C++ is not really the same thing though, mainly due to lack of a standard set of libraries and memory management.
  230. The definition of irony by Anonymous Coward · · Score: 0

    Python proponent constantly harp on that one of the advantages of Python is that it gets rid of the {} bracket debate, but completely miss the point that it opens up the more violent "space versus {}" debate or the "you indent 2 spaces? That's unreadable, I use 8 spaces" debate, or that "how the hell do I fix a file that has it's indentation structure broken because has a mix of tabs and spaces -- with braces this mess wouldn't have happened".
    Why not be done with it an use the Ruby/Modula style of:
    . . if condition:
    . . . . stuff
    . . end

    It's easy to reformat in a good editor to any tab style, and there's only one logical indent struct form.

  231. Re:Too bad... by Anonymous Coward · · Score: 0

    First off, I'm willing to bet that virtually none of the little apps you currently have running are written in Java/Python whatnot.

    If you're running bittorrent, you're running a python application.

    Extrapolate that a little... and you discover that means 20% of net traffic is generated by python code.

  232. Its still fair. by Some+Random+Username · · Score: 1

    Just because there's the possibilty of improved performance someday, that doesn't mean you can't compare what exists now. This is what exists, this is what people are trying to claim is so much better than python, this is what gets compared. If ruby increases in performance in the future then that's great, but right now it is a potential issue. Also, pike isn't as old as python either, and has fewer developers and a much smaller community, but its faster than python.

  233. You are missing the point. by Some+Random+Username · · Score: 1

    I have tried python. Whitespace didn't prevent me from trying it, it seemed fine at first. Then when I did something larger, I realized what a problem it actually is, and stopped using python.

    What I am saying is that removing curly braces does not add any benefit, the language is not any more clear or concise. But there are problems with removing the curly braces. So if you add up the fact that there is no benefit, but there are downsides, that means its a problem. If you don't mind dealing with the problem that's up to you, but trying to pretend its not a problem by claiming "its just like what you should be doing anyways, only kinda a pain in the ass in certain situations" isn't going to solve the problem.

    if a > b:
    if a > c: # indented with 4 spaces
    print "python forces me to use stupid editor settings" # indented with 8 spaces
    print "I am less productive in python as a result" # indented by a tab

    If your editor's indentation level is 4, then this is how the code looks. But the second print is always executed when the first one is, despite not looking that way. And you can always do bizarre ass indentation where every level is a different width. I realize you shouldn't code this way, and obviously I don't *intentionally* code this way. But there is more to programming than simply writing a piece of code the first time, many other people read it and edit it afterwards, and cause weird errors like this if they don't worship at the alter of python editor settings, or when they try to move a block of code to a different place, where the indentation is different, and have to try to fix it, and can very easily make a mistake. This is completely avoided by simply using curly braces, and any inconsistancies in indentation can quickly be fixed by running indent on the code.

    So, clearly removing the curly braces does NOT force the code to be indented clearly, instead it just forces me to use editor settings I dislike, have a hard time working with other people, and makes it a huge pain to move blocks of code since I now have to manually re-indent a whole crapload of code. Even if you don't think these downsides are a big deal, the fact is they are downsides, and there is no upside.

    1. Re:You are missing the point. by asdfghjklqwertyuiop · · Score: 1

      if a > b:
      if a > c: # indented with 4 spaces
      print "python forces me to use stupid editor settings" # indented with 8 spaces
      print "I am less productive in python as a result" # indented by a tab


      Well I wouldn't write or leave code sitting in a project with that kind of messy indentation in any language, curly braces or not.


      And you can always do bizarre ass indentation where every level is a different width. I realize you shouldn't code this way, and obviously I don't *intentionally* code this way. But there is more to programming than simply writing a piece of code the first time, many other people read it and edit it afterwards, and cause weird errors like this if they don't worship at the alter of python editor settings, or when they try to move a block of code to a different place, where the indentation is different, and have to try to fix it, and can very easily make a mistake.


      I guess that's just your style then. When I have to work on code someone else wrote or import code from one place to another the first thing I do is make the indentation style consistent regardless of the language. Changing the indentation style on any given consistently indented code block is not hard. Peronsally I use the tabs-to-indent+spaces-to-align style. Sometimes I'll change my tab stops several times while I'm working on the same project to accommodate long lines or make deeply nested code look less scattered. I just hate working on code that isn't consistently indented so I take care of that pretty quickly when working on something so I've never run into a problem in python.

  234. Re:Too bad... by DavidHopwood · · Score: 1
    Here's a more objective test for you: which languages underlie the vast majority of high-performance mathematical/scientific/engineering applications developed in the past decade?

    That tells you, at most, what languages people who choose languages think are better (not just fast) for mathematical/scientific/engineering applications. It's not really an objective test of what languages are actually fast.

    'Ambassador Kosh' certainly isn't the only one to have observed that the C and C++ community tends to measure speed based on microbenchmarks, and not on real-world applications.

  235. Re:Too bad... by ArbitraryConstant · · Score: 1

    Of course it's slow, but it was always intended to by a hybrid with C. Since a significant fraction of the libraries are written in C, it's not actually that hard to write reasonably fast Python code.

    For example, a project I worked on last year was only 20% faster in C than in Python. It relied heavily on the regex library, which is written in C.

    --
    I rarely criticize things I don't care about.
  236. Re:Too bad... by cakoose · · Score: 1

    Second, Java and Python are not necessarily slow.

    [Later...]

    Of course it's slow, but it was always intended to by a hybrid with C.

    I agree that you don't always need to be fast. The simplicity of Python when compared to C makes up for the speed difference in many situations. However, it's misleading to say that Python isn't slow.
  237. Re:Too bad... by Anonymous+Brave+Guy · · Score: 1
    That tells you, at most, what languages people who choose languages think are better (not just fast) for mathematical/scientific/engineering applications. It's not really an objective test of what languages are actually fast.

    That's true, of course.

    However, you're unlikely ever to get a study that produces the same large-scale, professional-standard development in two different langugages with development teams of controlled experience levels etc., just to see which one works better. The cost overhead would be terrible. The closest approximation I can think of is to consider the view of a whole community with huge amounts of experience and a genuine willingness to try new approaches if they look beneficial. In the absence of one of those, I suggest that the scientific software community is again the closest realistic approximation. Right now, that community is pretty heavily pro-C and C++ (with a bit of FORTRAN, but not much new work in it these days).

    This is a pretty heavy chain of assumptions, but what more authoritative study would you suggest, given what's ever likely to happen in practice?

    'Ambassador Kosh' certainly isn't the only one to have observed that the C and C++ community tends to measure speed based on microbenchmarks, and not on real-world applications.

    On the contrary; in my experience, the low-level guys are happy to take on whatever benchmarks are around. It's the high-level language guys, who are always trying to demonstrate that their pet language is "as fast as C" (or more likely "within a factor of N of the speed of C") that frequently cite microbenchmarks like the Programming Language Shoot Out.

    Using mostly (or only) imperative programming techniques seems to be the current favourite tactic here. After all, you can easily show that Language L is comparable in performance to C if you write lots of simple programs using L's imperative features, which probably compile down to pretty much the same machine code as the equivalent C would generate. This conveniently avoids using other features that Language L advocates cite as its big improvements, and thus it also avoids the horrible possibility that they might actually suck when it comes to speed.

    IMHO, a much more interesting study that the PLSO is to look at the structure of the high-performing entries in the ICFP competition, where skilled developers are writing non-trivial code in many languages according to their own preferences. The overall results there have been reasonably consistent over the years, and support many held perceptions very strongly: in particular, it really is the algorithm that matters most in practice, and the community's ideas of relative speeds of languages are actually pretty accurate.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  238. GPL is fine for a lot of projects by loqi · · Score: 1

    I don't think so. If you develop with Qt, you either have to pay big bucks to Troll Tech up front, or you have irrevocably committed to putting your software under an open source license. Since the latter is usually not acceptable to enterprises (even open-source friendly enterprises), this means paying a lot of money per developer up front.

    Keep in mind that there is plenty of software that never gets "distributed". Licensing isn't an issue then, really. If you use Qt under the GPL to develop an in-house tool/application/minderbinder, you're not exactly obligated to go set up a CVS repository at SourceForge.

    --
    If other reasons we do lack, we swear no one will die when we attack
  239. Re:Too bad... by Anonymous+Brave+Guy · · Score: 1
    The logical extreme of the "all apps must be as fast as possible" argument is to code in ASM. I suggest that anybody who pushes this argument write every app in ASM.

    I'd settle for making them all watch the first couple of lectures from a decent data structures and algorithms course. That alone would shatter the illusions of the McProgrammers who don't understand the different performance characteristics of a list, an array and a map. Just getting that simple choice right would do a lot to fix the pathetically slow code we see everywhere today.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  240. Re:Too bad... by jaydonnell · · Score: 1

    Are you implying that 1 gig of ram IS NOT adequate for most people?