posted: 2005-07-29 22:04:40 perma-link, RSS comments feed
Seriously. The last time I looked at python seriously was 1996. Then it felt very 4GL'ish. Blech. Plus, when everyone you know is a c/c++ coder it was hard to get people to respect scripting languages. Well, fast forward almost 10 years and guess what? It's still hard to get people to respect scripting languages, but all of that time and experience has only strengthened my appreciation of them.
If you come from a C++ background, Perl is at once disgusting and amazing, but the brace structure, system level API's, etc are all very familiar, and in my mind, Perl's DBI/DBD database libraries set the standard by which all other db APIs are to be judged.
THe problem with Perl is that it is just too flexible. In many cases bad code just runs. And this means that bad coders can run amok. It has two mottos: TIMTOWTDI ( There is more than one way to do it ) and "Making the hard stuff easy and the impossible merely hard." In some cases it makes things too easy. There are coders whose very nature is to choose the most complex design given the opportunity, and Perl gives them plenty of opportunity. Java does the same thing. I would say it encourages it, while C++ practically requires it.
And then along comes Python. Better object support than perl. Easier to read than Perl. Most of the features too. From the scripting perspective, it's like Perl without the cruft. Not as many libraries, or niceties of the CPAN module, but its been improving steadily.
From the Java perspective, as near as I can tell it has access to all of the libraries that Java has, plus its own and it makes damn near anything you'd want to do in java about 10 times easier.
One of the most important aspects of deciphering/supporting someone elses code is following "the one true path" -- that is, figuring out what the code does. Exception handling goes a long way towards keeping a lot of the error checking out of the way, but java can't get around the consant casting of types ( from streams to buffers to readers and writers and strings and string buffers ,oh my! ). And its api's are so over engineered in many cases. The result is code that's slow to write and slow to read.
Perl on the other hand doesn't impose any structure on your code, and is very forgiving in its interpretation of syntax. Larry Wall was inspired by c and awk and sed but wanted a language that was more expressive, more english like. Were it not for awk's influences I think it would have been near perfect. In the end, Perl is fast to write, but unless you are the author, it can be slow to read -- especially if undisciplined coders are involved.
Finally, on the other hand ( yes, I have three hands. How else can you type and use a mouse? ) you have Python. All of the speed and expressiveness of perl plus its fast to read. None of the cruft characters of perl and none of the casting nonsense of Java. Just high speed development.
I'm off this weekend to Portland for the OpenSource conference. I attended the first OpenSource conference last century and it was almost a religious experience. The energy, the geeks, the perl. It was awesome. This year I went to JavaOne -- Sun's equivalent -- and all I can say is 'eh'. It was much better produced from a pyrotechnic, kenetic, phrenetic stance, but I can't say I learned much. I think that first OSC set the bar impossibly high.
Now I can't wait to return to the OSC. This time, instead of Perl, I'm following the Python track. It's a brave new world. I hope it clears the bar.
Oh yeah. I hope my travel experience goes better this time...
Jay said on 2005-07-30 09:41:52:
On travel, remember Northwest Airlines' motto: "We're not happy 'til you're not happy."
On Python, I wish I knew more. Most sandboxes that let code babies like me play do so in PHP, which has many known strengths and weaknesses.
Python playgrounds are a bit harder to find.
error sifting isotopes local variable 'maxk' referenced before assignment error making suggestion 'NoneType' object has no attribute 'category_label' |
hosting: slicehost.com.
powered by: django.
written in: python.
controlled by: bzr.
monsters by: monsterID.
Hari commented, on August 21, 2012 at 2:44 a.m.:
The "something" can be accessed very elsiay with PHP. If you have a web page address that looks like this:index.php? month=september&name=smith&age=24Then you can access those values in PHP like this:<?phpecho $_GET('month');echo $_GET('name');echo $_GET('age');?>This will print septembersmith24.As for accessing a text file, that's easy too:<?php$text = file_get_contents( 'textfile.txt' );echo $text;?>This will read the entire contents of the file textfile.txt into the variable $text, and then print it out for you.You can also access many databases with PHP, I highly recommend you use MySQL. It's a bit too complicated to describe here, though. There are some good references made to good books by folks above. The "Teach Yourself" series is great.