Python Moving into the Enterprise 818
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!"
Jython? (Score:4, Interesting)
Advantages? (Score:4, Interesting)
Besides... wasn't Star Trek cancelled?
python performance (Score:4, Interesting)
Re:Advantages? (Score:2, Interesting)
Re:Microsoft's involved? (Score:3, Interesting)
A quick check on Dice.com (Score:3, Interesting)
Google is not enteprise? (Score:2, Interesting)
Re:Advantages? (Score:2, Interesting)
Re:Advantages? (Score:3, Interesting)
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.
Re:A quick check on Dice.com (Score:3, Interesting)
if you had checked for python jobs just 2 years ago i would be amazed if you could find any
(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
Re:python performance (Score:5, Interesting)
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 [slashdot.org]
Only a few tweaks needed (Score:3, Interesting)
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.
Re:Advantages? (Score:1, Interesting)
Hello world examples are contrived. In the enterprise, no-one gets paid to do hello world.
Re:Advantages? (Score:1, Interesting)
No CPAN == GOOD (Score:2, Interesting)
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.
Divide and conquer (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.
Re:No CPAN. (Score:2, Interesting)
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.
The "Different Style" Issue ... (Score:1, Interesting)
Re:python performance (Score:1, Interesting)
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
Re:python performance (Score:3, Interesting)
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.
Python still has severe limits (Score:3, 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 [evanjones.ca]. And for many tasks, CPython is still effectively single-threaded due to its global interpreter lock [python.org]. 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 [python.org] on CPython's memory management. The author is developing some patches to let CPython return unused memory to the OS [python.org] 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 [python.org] it looks like these patches haven't yet been accepted.
Kill the GIL (Global Interpreter Lock) (Score:5, Interesting)
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.
Re:Advantages? (Score:1, Interesting)
Re:A quick check on Dice.com (Score:3, Interesting)
You can repeat the same ol' tired mantra, over and over, it doesn't make it true.
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
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,
And it is being heavily used in Enterprise development.
Re:Why is whitespace significance a good thing? (Score:2, Interesting)
Re:python performance (Score:5, Interesting)
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.
Re:Too bad... (Score:2, Interesting)
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.
hmmm (Score:2, Interesting)
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.
Not perfect but good for many things (Score:2, Interesting)
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.
Re:Too bad... (Score:3, Interesting)
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:
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
Re:Advantages? (Score:1, Interesting)
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.
Re:Advantages? (Score:4, Interesting)
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:
Because at my company, code looks like this:
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.
Finding a good general purpose language is hard! (Score:3, Interesting)
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:
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.
Re:Advantages? (Score:1, Interesting)
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.
seriously mistaken information. try is 24x slower (Score:3, Interesting)
I benched the two pieces of code: (note the slashdot ecode tag removes the proper indentation, but this should be obvious in context)
and then using your suggestion: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.
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.