Mark Lutz on Python
Betsy Waliszewski sent in this interview with Mark Lutz, author of Programming Python. He discusses the evolution of Python during its brief history, XML support and .NET, and takes a brief look at the future of Python.
← Back to Stories (view on slashdot.org)
Python is very powerful - it's killer app is Zope. Zope Makes PHP, Mod Perl and just about every commercial application server out there look *very* lame.
I like to think of python as toilet paper -- I mean this in a good way, mind!
After all, where would we be without toilet paper? Such a world scarcely bears thinking about. Yet for a great many years (up into the industrial age) it simply hadn't been invented.
The march of technology is gradual, and the uses of a product are not always immediately evident. Paper itself had been invented centuries earlier by the Chinese, yet it wasn't until the time of the great Thomas Crapper that it could reach its full utilisation. Use of paper in an old-fashioned privy would have been disgusting and ridiculous. But in a water-based toilet, it is heaven on earth.
Python is in much the same position. It is truly a splendid language, with features (e.g., whitespace formatting and garbage collection) that have been maligned in the past, and with good reason I might add. But hardware capabilities have moved on, and these are no longer liabilities, but features. Python is elegant, simple, safe, and above all it gets the job done. Previous tools could do the same work, but not nearly so comfortably.
(And where does perl fit in to this analogy, perhaps you ask? Well, you see, the Japanese used to have use a thing called "the toilet stick"...)
$ python
>>> import Queue
>>> q = Queue.Queue()
>>> item1 = ["this","is","a","list"]
>>> item2 = "now a string"
>>> item3 = 3
>>> q.put(item2)
>>> q.put(item3)
>>> q.put(item1)
>>> q.get()
'now a string'
>>> q.get()
3
>>> q.get()
['this', 'is', 'a', 'list']
>>> q.qsize()
0
Python is fun because you can write very useful, complex, and READABLE programs very quickly. The startup curve with Python is extremely small compared to other languages, which is great.
A professional programmer cares about the quality of his/her code and the people who come later who have to maintain it. Code which isn't maintainable might as well not have been written.
When I think of a cleaner Perl alternative, my thoughts switch to Ruby (not Python) as well. The main reason Ruby hasn't taken off is that all of the docs were, until the last couple of years, written in Japanese.
Now that there is a good english Ruby book and apparently another on the way from O'Reilly that's changing.
BTW: In Japan, Ruby has taken off.
"C'mon, they're using MySQL. Were you really expecting there not to be massive data loss?
mystack = ['blaad', 'test', 'new']
# pop
poppedvalue = mystack.pop()
# push
mystack.append('new element')
is the #1 reason python has not completely replaced other scripting languages as the preferred choice. His books are awful. I can only conclude that Mark wrote these books because he is secretly a perl zealot. He felt threatened by python and decided to write books to impede the collective python learning process. For now, stick with the docs at http://www.python.org
Webware gives you servlets in Python. I would recommend it -- Zope isn't by any means the only way to use Python on the web (thankfully).
I've never used Java servlets, but I've read a few bits of sample servlets. They seem to me to be painfully verbose. I'm all for long variable names and all that jazz, but Java just seems to make you jump through hoops for no good reason. It's not just that it isn't fun, or requires lots of typing, but verbosity makes for a bad language. You should be able to say things as you mean them, verbosity obscures that.
However, Java may not be so bad on a larger scale. Perhaps the example code doesn't want to build even a small library (since its just an example) and in a real project you'd do that and simplify things.
Another thing I like about Python is the extremely dynamic nature. You can have a dynamic inheritance tree, for instance -- consider an entire framework where you could subclass major components and those subclasses can easily insinuate themselves into the depths of the framework. This allows you to make radical changes to the framework without compromising the distinction between your local code and the upstream code. To do this requires that classes be first-class objects, so you just can't do it in Java.
This hasn't and isn't going to happen for Smalltalk. There's no clean, well-partitioned way to install a Smalltalk runtime. It's overintegrated and overly insular. So it can't come in slowly, with small programs and utilities being written in Smalltalk.
Previous posters have already mentioned the "wall" between the environment and the host system, and while I can understand the reasoning behind it, it is dated reasoning.
The bigger issue I have with Smalltalk (or perhaps just with Squeak) is that there is no syntax. Everything is an object, including such tradition keyglyphs as '='. That's swell, except that it means syntax is defined wholly by the object in question. Various classes had their own ideas of how they wanted their parameters arranged when they were instantiated or their methods called. It was horribly inconsistent. I spent more time reading "library" code in that language than I have in any other, and I remember almost none of it because it was so often conflicting.
It was a cute idea... pure OOP from the ground up. But it sure did turn into a nightmare.
Danny.
I have written over 900 book reviews
Check out the Python - Objective-C bridge project at Sourceforge. It appears to be coming along slowly. In the mailing list archives you'll also find discussion of using Jython with Apple's Java bridge as well.
seriously, use what works best.
Chris Cothrun
Curator of Chaos
Bleh!
Well, Python is in an awkward position right now -- it isn't the newest and coolest scripting language anymore -- that's Ruby these days, and at the same time it isn't the standard scripting language (which is still Perl). Without the coolness factor it had in the mid '90s, Python's hope for growth lies in people hired to maintain code written by the first generation Python hackers, and this means slow (if steady) growth.
for no other reason that when I'm 5 levels deep and want to write something like someProperlyAndDescriptivelyNamedVariable = somObjectWithAnotherLongAndDescriptiveName.aMethod WithSimilarlyLongAndDescriptiveName(someObviouslyN amedParameters,someOtherObject.someOtherMethod()); it's running off the side of a normal xterm real quick
d WithSimilarlyLongAndDescriptiveName(
You know that Python lets you put parens around an expression, and then have the expression span multiple lines, right? eg:
someProperlyAndDescriptivelyNamedVariable = (
somObjectWithAnotherLongAndDescriptiveName.aMetho
someObviouslyNamedParameters,
someOtherObject.someOtherMethod()
)
)
By the way, the trailing semicolon is unnecessary.
So you've got your editor configured incorrectly. Set your tab width to 8. Then you'll be seeing what Python's seeing.
Python has taken off. Yes, less people use Python than use Perl. But less people use Linux than Windows. The difference is between the people in the know, and the unwashed masses... :-)
The whitespace thing is pretty easy to deal with; simply be consistent. Python doesn't care if you use tabs or spaces, and doesn't care how many tabs or spaces you use, *as long as you're consistent.*
There are a few utilities to check your source for proper indentation, or to convert tabsspaces.
And the major macro-programmable editors all have hacks that let them deal very intelligently with whitespace, including automatically indenting at appropriate times.
Plus there are a few Python-specific editors, that also do code-colouring and such.
All in all, FeErOfWhItEsPacE is silly.
What's the problem with lists? How would you want to write them??
--
--
Don't like it? Respond with words, not karma.
Well, now, let me just rip this off directly from a Python website (http://www.python.org/psa/ Users.html). And there was a recent thread in the Python newsgroup, mentioning about a dozen more big names.
Thing of it is, Python does what it does so well that no one notices it.
It's like when you walk into a retail store. You don't notice that the carpets are clean. The carpets don't call attention to themselves. They're just *there*, doing their job.
Only time you notice a carpet is when it's filthy. When its syntax is filled with !@$% symbols. When it has memory leaks. Etc.
Anyway, the shortlist of companies using Python in commercial apps:
Advanced Management Solutions Inc.
* AMS provides the AMS REALTIME suite of enterprise software for project management, resource management, cost management and timesheets. The Python language engine is embedded in AMS REALTIME as a means of extending the products, and also as a way of enabling custom behavior and company-specific business rules to be supported.
CWI
* CWI, Python's home, has used Python in, among other things, GrINS, a 20,000 line authoring environment for transportable hypermedia presentations, and a 5,000 line multimedia teleconferencing tool, as well as many many smaller programs. See the collection of multi-media project papers.
Digital Creations
* A long-time sponsor of the PSA, Digital creations develops with Python - and also makes some of their Python software available for free!
ILU
* ILU (it's spelled Inter-Language Unification but it's pronounced eye-loo) is a (very) CORBA-ish multi-language object interface system. It has bindings for Common Lisp, C++, ANSI C, Modula-3 and Python.
Automatrix
* Musi-Cal(tm) is the first online calendar that provides easy access to the most up-to-date worldwide live music information: concerts, festivals, gigs and other musical events. It is maintained by Python scripts. So is their Internet
Conference Calendar.
Nightmare Software, Inc.
* Nightmare Software builds 32-bit Windows software with Python - and gives some away!
Infoseek
* Ultraseek Server, Infoseek's commercial search engine product, is implemented as an elaborate multi-threaded Python program with the primitive indexing and search operations performed by a built-in module. Most of the program is written in Python, and both a built-in spider and HTTP server can be customized with additional Python code. The program contains over 11,000 lines of Python code, and the user interface is implemented with over 17,000 lines of Python-scripted HTML templates. Try it out on the Python.Org web search page or download an evaluation copy from Infoseek Software.
eGroups.com (previously Findmail)
* A comprehensive public archive of Internet mailing lists, implemented in pure Python. Latest statistics from Scott Hassan: 180,000 lines of Python doing everything from a 100% dynamic website to all email delivery, pumping out 200 messages/second on a single 400 MHz Pentium!
DataViews Corporation
* DataViews Corporation in Northampton, Mass., have been using Python internally quite a bit.
LLNL
* A group at the Lawrence Livermore National Laboratories is basing a new numerical engineering environment on Python, replacing a home-grown scripting language of ten-year standing. Paul Dubois is a central figure in that effort.
NASA
* Johnson Space Center uses Python in its Integrated Planning System as the standard scripting language. Efforts are underway to develop a modular collection of tools for assisting shuttle pre-mission planning and to replace older tools written in PERL and shell dialects. Python will also be installed in the new Mission Control Center to perform auxiliary processing integrated with a user interface shell. Ongoing developments include an automated grammar based system whereby C++ libraries may be interfaced directly to Python via compiler techniques. This technology can be extended to other languages in the future.
IV Image Systems AB
* IV Image Systems uses Python for many projects, including a satellite image production system for the Swedish Meteorological and Hydrological Institute (SMHI) (see next entry).
This system receives raw data from several weather satellites, and produces images for many purposes, including the satellite images used for the presentation of the daily weather on Swedish TV 4.
For more information, contact Goran Bondeson.
Swedish Meteorological and Hydrological Institute
* SMHI is the home of the Swedish civilian weather, hydrological and oceanographic services. It's Python-based remote sensing software for automatic product generation, using NOAA and Meteosat data, provides information to bench forecasters, objective analysis schemes, and commercial interests such as the media. At SMHI's Research & Development Unit, a Python-based "Radar Analysis and Visualization Environment"
--
--
Don't like it? Respond with words, not karma.
I think you're underestimating the popularity of python. Python still has to ramp up a decent 'community module' system like perl has. Check out 'the Vaults of Parnassus' (google is your friend). It has not existed for too long, but there's a good set of useful modules there.
The fact is, when you see python, there is'nt "one magic application" that suddenly jumps out as "the perfect thing" to use python for. I think that's because sucn an application does not exist. Python is a bit like C - it's an extremely good general purpose programming language that does a lot of things well.
C is a simple, efficient, fast and portable low-level language for doing generic system programming.
Python is a simple, object oriented, modular, clean language for doing generic application programming.
Have you ever tried to do a large-scale project in perl? Something with a few ccomplicated nested data structures, a multiple threads modifying the same data model, some serious io handling? All of that rolled into one farm fresh breakfast unit. It's hard to do in perl - because perl was not designed with such uses in mind. It'd be LONG and annoying in C, because BSD sockets are a pain to work with, and C generally makes many things long and tedious (if you want to do them "right" anyway). C++ would be quite a bit better than C, but you'd still have to deal with the C system APIs, which will still be annoying. Java would probably give you quick development cycles, but nowhere near as quick as python.
I consider python as lying somewhere in between scripting languages and compiled languages. It lets you do structured programming and gives you a powerful OO structure and modules galore, but keeps the syntax simple and clean. To me, it's a lot closer to Java than Python (this stand is supported a bit by Jython).
It fulfills the 'glue' properties more than perl does for me. I see perl as sed with better syntax and modules (and I like perl, and use it quite a bit, dont get me wrong). Python is something you can use to quickly and painlessly write good, maintainable, modular, portable code.
-Laxitive
"Only time you notice a carpet is when it's filthy. When its syntax is filled with !@$% symbols. When it has memory leaks. Etc."
/usr/bin/env python" they don't actually realize that that means that the python interpreter is going to run. That you never have to look up a function? That you never make syntax errors?
Wow, you don't know much about rugs, do you? You also notice rugs when they're especially pretty, or contain interesting patterns, or tell great stories succinctly, such as s|\W|sprintf("%%%x", ord($1))|ge.
Btw, are you really implying that noone who programs with python actually notices the language? That they just subconsciously add in the name of the interpreter in the #! line at the top of the program, without it ever occuring to them that when they type "#!
They laughed at Einstein. They laughed at the Wright Brothers. But they also laughed at Bozo the Clown. -- C. Sagan
The license is causing me to look at Ruby. I don't like having the license specify that a UCITA state controls what the license means.
Caution: Now approaching the (technological) singularity.
I think we've pushed this "anyone can grow up to be president" thing too far.
I like Ruby better as a language (I prefer braces, e.g.). But Python is better developed, and has a larger library, and has more documentation.
It all depends on what you want to do. Certainly if it's something that someone has already written the code for, then Python is more likely to have it pre-done. Also, many more systems come with Python already installed. And Python has a freeze system for packaging up a program into an executable for distribution. I've not yet used it (I tend to drop into Ada or Eiffel if I want a compiled module), but it's there.
OTOH, Ruby currently seems to be changing faster than Python. I suspect that this is largely importation of stuff from Japan, where Ruby originated, but the effect is the same. Still, there is currently only one book on it (though another [by Matz] is on the way).
Caution: Now approaching the (technological) singularity.
I think we've pushed this "anyone can grow up to be president" thing too far.
I'm a python newbie, so take this with a cistern of salt:
Python is good for almost anything, but it's particularly good for studying programming, prototyping and as a 'glue' language. Let's rephrase the question, however to 'why hasn't it taken off more spectacularly?', because it is really quite popular and widely used, just not as much as perl or java. Now, when people are picking their first language they will often pick the one that's the most 'marketable' like C or java or perl. They don't understand why a good glue or prototyping language is important, and naturally they don't want to study language that's good for studying, they want to study a language that's good for doing something they need done. In my opinion, perl gives you an opportunity to do some really powerful and exciting things real quick, sacrificing some readability, maintainability and consistency in the process. On the other hand, newbies will find out that winamp, napster, etc are written in c++ and/or c and will prefer to study that, because of familiarity. And lastly, a language that
really shines at prototyping and 'gluing' will have inherently lower visibility than other languages (undeservedly, imho). All these things considered, it also surprises me that python isn't more widely used. Is this the dreaded 'worse is better' law at work? Are many people bugged by indentation syntax? I don't know, perhaps someone who tried it and decided against using it can share his reasons?
-- ATTENTION: do not read this sig. It doesn't say much.
I ran into this problem once, but it's not a big deal: it's trivial to convert tabs to spaces in any decent editor. I think the enforced readability advantage is well worth it.
-- ATTENTION: do not read this sig. It doesn't say much.
I looked at it but didn't like %&$'s - the whole reason I use python is clean syntax (well, the main reason, anyway).
-- ATTENTION: do not read this sig. It doesn't say much.
Python's fun to me, personally. I can't agree with 'dirty is good' concept, either - I prefer clean code, even when it's a 5 line script.
-- ATTENTION: do not read this sig. It doesn't say much.
Well, what about different bracing styles? Not to mention braces adding clutter and taking up precious lines :-).
-- ATTENTION: do not read this sig. It doesn't say much.
... and it's used in ESR's CML2 the new kernel config system to come in 2.5.
I think many overlook it not because it is not used as much but because no one makes a big deal out of its use. Zope is a good example of this. It is used in some very large organizations and it is a very powerful product. Many still confuse it with a web server though when in reality that is only the smallest part of its capabilities. What it really is good for is publishing python objects to the web, other servers via xml-rpc and other number of other things.
I know a lot who use python because it gets the job done cleanly and efficiently however they rarely make a big deal out of which tool they used and most don't care what the solutions was coded in since it works pretty much without fail. Kind of how some people don't know their servers run unix because they have never had a need to know but everyone who has a windows server pretty much knows it because the server calls attention to itself.
Do to the structure of python code tends to be designed rather then hacked together which in the end gives better running programs that have fewer bugs and are more modular, thus easier to fix and extend.
Computer modeling for biotech drug manufacturing is HARD!
heh. That's one of the funniest descriptions I've heard of perl yet.
I love perl too (and I'm anxiously looking forward to Perl 6, which will hopefully have some of those shiny OO enhancements I've been craving. Alot of my scripts end up in that paradigm, and I'd love a few of the things mentioned in Apocalypse 2).I've started picking up python finally, mostly because of jython. I'm planning on moving to JSP and servlets for web development, and the thought of being able to prototype quickly in python, and have two languages to choose from depending on need is awful appealing. More, I have a lot more confidence in training people in a bit of python than a bit of java, if need be.
That said, I don't think I'll be giving up perl anytime soon. It's a powerful language, and I like how obvious it is that it was developed by a linguist. It maps well to my brain. You can do amazing things with perl, in a very short development cycle, and with a bit of discipline, produce code every bit as maintainable as any other language. (sloppy perl coders have just been giving the rest of us a bad name).
To be honest, the biggest reason I haven't picked up python sooner is the rabid python evangelists. God, they're annoying. It's a language, not the holy grail. Get some perspective.
Conclusion? Different tools. I'm glad there's python. I'm glad there's perl. One's not going to be suddenly displaced by the other. I sort of think of python as the brazen adolescent, trying to figure out where it fits in, and pushing at it's elders. It will settle down, and be useful for a long time to come, I'm sure.
That was a bit of a rant, but I feel much better getting it off my chest.
- eddy
This is the voice of World Control. I bring you Peace.
it's quite favorable and puts things in a nice perspective. not all languages make it past a comparison with one of the coolest language on the planet.
check it out at http://www.norvig.com/python-lisp.html
> Yes, there are modules out there, but nothing like CPAN or gamelan or even MFC/C++
> codeguru.
It should be noted that Python comes with a whole heck of a lot of useful modules, so out of the box, there isn't as great a need for an external module archive such as CPAN. However, Python folks are working on a CPAN-like collection for Python too. See Python's Catalog-SIG.
For what you get in Python, see its Global Module Index. You'll see why they say 'Batteries Included'.
He might be a great advocate, but lord.. probably the only Orielly book i felt cheeted on. (Maybe the only other one of from ORielly would be mastering TSQL) :)
*Sigh*
--------------------
Would you like a Python based alternative to PHP/ASP/JSP?
Enjoyable to write Python code?
Yes -- it's clean and explicit, which means your eyes won't glaze over when you revisit it a week/month/year hence.
Hmmm... Stack in Python... really hard... mind boggles:
Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> z = [1, 2, 3]
>>> z.append(5)
>>> print z
[1, 2, 3, 5]
>>> print z.pop()
5
>>> print z
[1, 2, 3]
>>>
In all truthfullness though, the book does suck... I like "The Quick Python Book" much better. And the html manual kicks ass... and there's always doc strings!:
>>> dir(z)
['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'so
rt']
>>> print z.append.__doc__
L.append(object) -- append object to end
>>>
In all truthfullness, you shouldn't: Java is faster than Python, and servlets kick ass.
:-)...
But say you wanted to be able to extend your servlet code, poke at live servlets, or get a lot of 'dirty' information out quickly (quickly as in development time). You can go to jython.org and grab a fully compliant Python interpreter implemented in Java. Presto, you got yourself a 4GL over your Java code. You can go google for JPE, a Java-Python bridge and go load Python extensions in C/C++ (much easier, IMHO than JNI) and talk to Python from Java and vice versa. Both Jython and JPE allow you to extend Python from Java and vice versa. That kicks ass...
Java has its place (that layer of apps just above C/C++) and so does Python (the layer on top of Java). The really great thing is that you won't have to switch mindsets. Python is clean, consistent, and really, really easy to write (much more so than Java, again IMHO).
Again, IMHO, I'd much rather prototype code in Python, work on the design, see what my design is missing, where I have to plug holes, and I can do so really quickly and easily (Python allows you to be more dirty than Java; multiple inheritance, writeable namespaces, exec(), etc...) and then I can profile the code (profiler comes with the std library) and extend the performance-bound parts in C/C++, again very easily. NumPy for example includes all of LINPACK: you get really great C/Fortran speed in numerical functions, but you get to use a RAD language.
Try it, you'll like it. Damn, that should be the Python slogan
Man... I love writing code in Python... it is fun as hell (OTOH, I also write awk, ksh, a coupla obscure SPLs you never heard of, so it's probably a bad comparison :-). And the truth is, you can be "dirty" in Python: do things the quick and easy way, instead of the proper OOP way. But, python allows you to quickly read even through bad code. And its ability to be dirty allows you to refactor such bad code easily.
Always, always, good code comes from good coders. A good language though, a) doesn't throw away the key of what the code does *cough*Perl*cough*, and b) allows you still enough flexibility to fix code, hack things together fast, etc *cough*Java*cough*.
Don't expect all of Perl's bells and whistles in Python: Guido doesn't want to pollute the language with equivalent ways of doing things, which makes perfect sense to me: helps readability, and forces everybody to strive towards increasing performance and features in the same 'niche' of code. But there's also *plenty* of power in the language and there is a very big toolset to work from...
Let me add to the list a 3,000 line package written in Python by yours truly that wraps around Microsoft Visual SourceSafe so that VSS can be used by Unix clients (python CGI talking to a python client script).
:-)...
If anybody's interested I can put the source up for everybody to see/use (no docs though
My personal experience is that Python is also CPU hog, although fast, for all that.
The point being, you might find really different results depending on how hard you stress certain things. And once you find resulting bottlenecks, you [should] start optimizing. So even pretty good comparisons can be made very questionable in the hands of good programmers and administrators.
<flamebait>
On the other hand, Python makes the "whitespace overloading" hoax seem plausible.
</flamebait>
Seriously, Perl is a two dollar whore when it comes to syntax, but that's a good reason to keep coming back. Perl works better for me for many things. Its poor performance on object creation, method invocation, and some other areas was interesting. If Perl had good OO, it would be a lot better for certain kinds of use... and under sustained use (where startup costs are more negligible) I have found it to be extremely fast (e.g. under mod_perl).
This post is illegal.
Boss of nothin. Big deal.
Son, go get daddy's hard plastic eyes.
Expanding a vast wasteland since 1996.
Pro 1: One big benefit is its ease in debugging.
Pro 2: It's easier to write than Java (well, for me, anyway)
Con: If you don't know Python yet, a "huge" project isn't exactly where I'd start...
I find the old "Perl vs Python" battle a bit tiresome. While reading the article, though it hardly touches on Perl, I KNEW it was just bait for battle.
I don't think that his book was bad (I've read it). I think Python rocks. I don't know very much Perl, but we use both extensively at work and I can see that they each have their strengths.
On a positive note, I wrote my entire website (and I suck at site design, I know...) in Python, and it was (and still is) quite a fun project.
Just my $.02. Flame away, please.
I can code well in several languages/environments, including C/C++, perl, Emacs Lisp, Java, x86 asm etc.. up until very recently I've ignored Python completely.
Once you know one language its easier to pick up another, however when you get to point when you can program in four, or five, you wonder what the point of learning another one is.
Anyway, I've just been trying to find a web-based jukebox for a large MP3 collection - and the best one I could find, (that didn't need a database or anything fancy), was Edna - and lo, and behold, it was written in Python.
After looking over the 300 lines of code that implements a webserver, a jukebox, and playlist generator I'm now increasingly tempting to learn more ... if only I could get my head round the way lists are written, and the whitespace thing...
Steve
---
I can give you _my_ opinion. I was doing commercial work in Smalltalk back in 1982, at Xerox. It was heavenly! Great development tools, a really easy to program GUI, and a powerful language with extensive libraries.
Smalltalk's biggest problem, though, was "the wall" that the language put up between itself and the operating environment. Whenever you had to interact with something outside of Smalltalk, it was extremely painful. I think it eventually killed the language as a serious contender.
The "wall" wasn't there because the language designers were silly, by the way. It was a response to the fact that in the 70s when a lot of the Smalltalk thinking was being done, different OSes were really, really different. Smalltalk was portable because of "the wall", which was a big win. Today, the various OSes are much more similar, and the choice doesn't look as great.
By the way, Squeak, the successor to Smalltalk, looks very good. It still has "the wall" though, which is why I don't spend more time with it.
Kurt
Where have you been hiding? Python has gotten pretty interesting, especially the nifty stuff you can do with Zope and Numeric Python. As for a CPAN equivalent, you may want to check out the Vaults of Parnassus at http://www.vex.net/parnassus/
For a language that hasn't taken off, there's a lot of stuff to be enjoyed (over 900 goodies at VoP last time I checked). Nifty net stuff, interesting numerics, GUI systems, sound and graphics libraries, and so on. Not to shabby.
I used to hack a lot more in Perl, but it got to the point where I do anything more than a few hundred lines in Python instead. It's just a lot easier to get it working and keep it working in Python.
Python has not "taken off" as Java did or Perl did in their day because it is not synonymous with an exciting new platform like applets or CGI. Not that applets or CGI matter today but they were neverthless great publicity for those languages.
Python is too general purpose to get attached to any particular niche like that. It is just a little bit better for most taks than most of the competition. If you don't believe me you'll have to try it out yourself.
I was a Smalltalk (VW 2) programmer in '94-96 and I totally agree. The portability was absolutely amazing. You could program an application from the ground up on Windows and move the *binary* to HP-UX and it would run, perfectly.
I loved the language, too. Because of the extensive class library, you could code major functionality in a method of, say, ten lines of source (often less).
As our project matured, we were forced by upper/middle mgmt to develop in c++ on HP-UX. It was a pain until the company licensed a toolset called tool++.h, which was in a way very funny - what it did was provide a Smalltalk-style class library to our UNIX c++. We were able to do useful things, again! But, still, we always wished we were still doing it in Smalltalk.
Alright, I admitt I should probably spend a few hours pouring over python literature, but hey, that's what /. is for, right?
So, my understanding is that Python is probably more useful for projects that involve lots of glue code (COM talking to CORBA talking to Java, etc). I also seem to get the impression that Python doesn't suffer from the "too chaotic for big project" problem that Perl has.
So help me out here. I'm writing a huge, scalable middle-tier in Java using servlets and JDBC. Why should I bother with Python?
Pros Cons etc. Whats the story here people?
Someone you trust is one of us.
That sounds like a VERY interesting project. I'm sure that you could find a home for it at sourceforge.
I heard about Python several years ago, from a guy who was at Xerox PARC at the time. Yet today, the Python movement doesn't seem to be much farther along.
Java's lost some oomph in the marketing steamroller but gained some badly needed credibility with servlets.
Perl has gone from an obscure report munger to a community powerhouse. You want a feature? Perl has it.
Python's been ported to just about everything including PalmOS, but the shared source code I've found has been extremely limited or arcane. Yes, there are modules out there, but nothing like CPAN or gamelan or even MFC/C++ codeguru.
From the little I've investigated of Python, at three different occasions, it's clean, fast, easy to embed, easy to extend, easy to code for. Some people balk at the indentation style but that took me 30 seconds to get over. Some people balk at the shell interpreter aspect, but that felt like a prolog or lisp pmachine interface to me.
I'm not flaming, just wondering, what has Python been doing with itself, to have grabbed so little attention in the world stage?
[
I'm no expert, but I'm not sure you can say absolutely that there are more appropriate languages than Python when it comes to doing oo work. Bruce Eckel is probably an expert though. Here's an interview:a m_ id=466
http://www.technetcast.com/tnc_stream.html?stre
-beme
-beme
1971
It [Python Essential Reference] makes no attempt to teach you how to program --so don't buy it if you are new to programming AND to Python. But ifyou've used several languages and want to do a project in Python it is quite useful.
It is the only Python book I own, and the few times it has not had the information I need (mostly specifics about modules) I've been able to find what I need in the online documentation.
How can I resist? For a redesign of lisp that is actually better, see Standard ML at:
m l
http://cm.bell-labs.com/cm/cs/what/smlnj/sml.ht
Also for a more hacker-oriented flavor, try O'Caml at:
http://caml.inria.fr/
Haskell (haskell.org) is also worth checking out, too.
I agree. I think this was a minor design error that they are always on the defensive about, since people always seem to point that one out. =)
cc-mode for emacs does an awesome job of auto-indenting. Just go C-c C-q and the whole function is beautiful. Whee!
I guess I was trying to say that for scripting tasks, you probably don't need the "object-oriented" methodology. For programs that do, well, there are more appropriate languages.
Yes, I have tried Python. =) As I say, it is nice, but that's not what seems to count for (many) hacker types!
I think people prefer perl because, given all its intricacies and built-in features, programming in perl is fun. It's an adventure.
Programming in python might produce better code, but it is enjoyable to write? Most write-only code (ie, scripting tasks) are tedious if you write them the "nice" way. Hackers find (perverse, perhaps) joy in writing these clever minimalist perl scripts that rely on its various uncivilized features.
When it comes to writing big code, though, writing in any scripting language is problematic for a number of reasons. (Not the least of which are performance, lack of modularity features, and difficulty in producint "stand-alone" apps.) So even if Python may be a nicer language in almost every respect (and who's to say if it is?), that doesn't mean anything, because scripts were meant to be dirty.
In other words, when it comes to scripting languages for use by hackers: terse, tricky, stateful, but "powerful" languages win.
There are now. This is my preferred (YMMV): glade+python(with gtk and libglade modules). Yo go like this:
Clean and fast.
Ciao
----
FB
No actually I didn't know that. Thanks for replying, I may have to look at python again. (I suspected the semicolon was redundant but after hacking in C long enough it's sort of an instinct ;-) ).
--
News for geeks in Austin: www.geekaustin.org
News for Geeks in Austin, TX
Just my two cents, becuase I think that having a central print magazine coming out every month is a really strengthening thing for a "marginalized" community (e.g. what the linux journal did/does for the linux community). I say "marginalized" from the standpoint that python is a much smaller community than, say, java.
My other four cents worth would be a) something besides whitespace for block indentation (by that I mean let me use {} if I want to, and I do, if for no other reason that when I'm 5 levels deep and want to write something liked WithSimilarlyLongAndDescriptiveName(someObviouslyN amedParameters,someOtherObject.someOtherMethod());
someProperlyAndDescriptivelyNamedVariable = somObjectWithAnotherLongAndDescriptiveName.aMetho
it's running off the side of a normal xterm real quick) and b) constructing a CPAN equiv. (addressed by posts above, so thats minus two cents).
--
News for geeks in Austin: www.geekaustin.org
News for Geeks in Austin, TX
Ok, pygame is my project which wraps SDL for use with python. The project reached version 1.0 about a month ago. Just recently I was able to release SolarWolf, which is a full featured action/arcade style game. (it's worth your time in gameplay too) :]
This type of project goes a good way to show python is more than up to the task for quick paced arcade games. Currently pygame is adding support for the pyopengl modules, which is looking surprisingly good in terms of performance.
Honestly, seeing my humble project listed in the "What do you think are the most exciting developments going on in Python right now?" answer has made for a sweet day!
Perl is hard to spell too... Pearl? Perl?
This isn't a dig at Python; something good is something good, no matter where it turns up. But what is it about Python which makes it popular, while Smalltalk never seems to quite make it?
But ParcPlace not taking up Sun's offer to bundle VisualWorks with SunOS. Ow!
There's got to be more to it than that, though.
--
--
All my respects to Python, but I have to ask the same question about Ruby.
As you say, it's clean, fast, easy to extend, easy to code for. And there's no whitespace issues to balk at, even for 30 seconds (although there are legitimate reasons to balk at whitespace issues for more than 30 seconds).
I have used Perl almost extensively, and love it--Perl deserves all the use and attention it has--but when I think of something "cleaner" I'd like to use, my thoughts switch to Ruby, not Python.
In Ruby's case, though, I can probably say its age is why it hasn't moved further yet (at least in the U.S.;the first Ruby conference is this year). Ruby's acceptance has moved rather quickly when you think about it.
If you have been thinking about Python, and haven't taken a look at Ruby, *please* do. You'll probably like it. Ruby's too good to not at least check out.
www.ruby-lang.org
-Kraft
-Kraft
Live and let live
Let this be a lesson on how fatal software bugs can be and how even bad jokes can lead to tragic results:
The wrong poverty attribute is set in the method solveWorldPoverty() - I mean how bloody obvious was that but still - the worldPoverty attribute is actually part of the super languagePlatform.., Java and not relevant here. I should have set the attribute noMorePoverty instead. (Note to self: you are an idiot!)
See how such a small error can cause such a catastrophic problems on a world scale! My apologies go out to all the victims. I am truly sorry.
Just imagine if I had used Office 2000 instead of Office 10 to cure cancer though ... *shiver*
Hahahahahaha! Python, Perl, Java,
I own your buzzwords .... I own your languages ......
Ladies and Gentleman I introduce the language, the platform, the enabler that will unite the world ..........
Jython#PerlC++XMLNET
I have a prototype and some examples shown below, in java, for you to realise the power and show that I am not talking out my arse:
public languagePlatformEnablerAndAllRoundGoodGuy Jython#PerlC++XMLNET extends Java implements Python, Perl, C++, C, C#, .NET, XML
{
private boolean worldPeace = false;
private boolean noMorePoverty = false;
public void solveWorldPeace()
// World peace brother!
{
worldPeace = true;
}
public void solveWorldPoverty()
// No more poverty man!
{
worldPoverty = true;
}
public void cureCancer()
// With the powerful new feature of M$ Office 10 who needs cancer!
{
new MSOffice10().setCancer(false);
}
}
I think so, but thats personal bias. I've taken the time to acclimate myself to the language, and use it fairly extensively for html generation.
I'm considering cleaning up my scripts and releasing them in some sort of mishmash, just on the off chance that other people can make use of them..
"But perhaps the most important change is Python's growth in popularity. "
$Cha-Ching$!!!
Words should not be used as delimiters of any kind.
--
The whole issue in question would never have come up had this been available in the days of "Programming Python [1st Edition]."
Instead of showing one simple way of doing it, he showed many complex ways of doing it, justifying it on the grounds of performance, thus implying that it was necessary for acceptable performance. These are exactly the kind of trade-offs and effort that one goes to a scripting language to not bother with.
Where Programming Perl tells you over and over again "do it however you like, it's okay to be ugly as long as it's useful, don't worry too much about performance unless it bites you," Programming Python emphasizes things like performance, at a time when Python was much slower than Perl (has this changed much?), and well-thought-out elegant, maintainable code, in a language that's supposed to replace my favorite hack-it-out-in-five-minutes kludge language. That's entirely aside from the poor organization and generally bad writing.
--
I've got that steaming pile of excrement right here, propping up my monitor to eye level. The major practical example? How to implement a stack.
In Perl, you want a stack? Use push and pop on an array. Want a queue? A deque? A shelf or scroll? Use shift and unshift too. It's all done in C, and faster than anything you can write yourself in a scripting language, even though it's all random access, too. In Python, you write a class, making sure you provide all the methods you will want to use with it, and carefully considering the performance issues of various methods, because you're working around a tremendously slow interpreter to make a basic data structure that should be built into every scripting language.
(incidentally, the multifunction list of Perl is probably my favorite feature, even over regexps and hashes; I use stacks and queues for everything, far more often than I use random-access arrays)
That's the impression I got from this book anyway. I was very enthusiastic about Python before I read Programming Python. To this date I don't know whether Python really only looks good until you actually try to use it, or I just got that feeling of utter hopelessness from the book.
--
hmm, i don't like that. the common moron shouldn't program. maybe that's why it has a rather demented pascal-like 'for' syntax.
oh well, i'll try to keep up with both p's. they each got their good points.
--how long till the operators are jailed for anime-induced pedophelia and
There is also Boa Constructor for wxPython, a Delphi-like IDE.
Much nicer than Tk.
"Perl is worse than Python because people
wanted it worse." - Larry Wall, 14 Oct 1998
Python has been a good language for mission critical applications where maintaining the code is quite important. In a quite massive and critical system like the Google search system, Python has been quite extensively used and the reasons are obvious. The system tends to grow at a very fast rate and to cope up with it, we need a script language that is simple to maintain as well as that gives us the possibility of fast performance using embedded C code. What is the answer to VB in Unix platform. One of the linux gurus had a reply: Python + Tk. While this may be a little far fetched, this is definitely the best available alternative till another one comes by. In a world of C ,Java and Perl fanatics, Python is the silent language creating a revolution.
That's right, i just wanted to know if the effort to learn just another language would be worth it... has anyone tried Ruby, any experiences how it competes with Python? Thanks, Philipp