ethanthescribe ([info]ethanthescribe) wrote,
@ 2008-07-11 16:59:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
PHP vs Python
I've been spending a bit of time playing with Python, and comparing its main contender (IMHO) PHP.

This is still early on in the evaluation process, but so far:

FeaturePythonPHPPreferred
Apache IntegrationHaven't really done much with this so far.Has html templating built in, integrates very nicely.PHP
StructureUses indenting to show block levels... I don't like being told how to indent my code, but I'm coming to see how it could work.Uses standard C braces like almost every other language out there. I'm used to it, I like it, reduces learning curve.PHP
LibrariesHas a huge array of libraries to do all sorts of thingsHas a huge array of libraries to do all sorts of thingsAbout even
DebuggingPython comes with an integrated debugger, and an workable IDE of sortsDoesn't have an IDE, (although has many, many 3rd party editors et al) and I've never got the debugger to work in windowsPython
Cross PlatformWorks on pretty much any platform out thereWorks on pretty much any platform out thereAbout even
ModulesHas a well integrated system of organising modules, and sensible use of namespacesHas a flat namespace... thus all function names have to be unique. Classes take some of the sting outPython
Error CheckingNot badNot bad, once you learn how to turn it on properly.Python by a smidge, but then neither come close to Delphi
DocumentationGood, centralised online documentationGood, centralised online documentation. PHP is better organized and has way more examples.PHP
List HandlingHas lists and dictionaries, seems to have powerful manipulation functionsArrays can be mapped or indexed, and have  powerful list manipulation commands.About even, but I think I prefer the PHP approach.
SpeedReasonably fast for a scripted language.Very fast to load, and pretty damn snappy to run.PHP


In conclusion (so far) I think PHP is the better language for web pages, and Python is better for general purpose programming.
PHP has the fastest load time of any of the web app languages I've tried, by several orders of magnitude in some cases. This is important for web stuff.
Delphi whips them both for sheer productivity and ease of use, but is not cross platform (and commercial to boot, although there are free 'Personal' version out there)


(Post a new comment)


[info]etfb
2008-07-11 02:06 pm UTC (link)
I'd argue that Python's list handling is waaaaay ahead of PHP's. You probably need to read up on it more, since a lot of it is syntax rather than functions. PHP has nothing to compare with the Python idiom of [(x,x**2,x**3) for x in range(1,6)] => [(1, 1, 1), (2, 4, 8), (3, 9, 27), (4, 16, 64), (5, 25, 125)]

The big problem with PHP is that the vast majority of its users are cretins, and of the remainder most are morons, and of the remainder of THAT most are complete idiots. It's the Visual Basic of teh intarwebs. So a lot of the "advice" and "examples" you'll find are so useless as to beggar belief. That cuts down on the value of the documentation; and the package/namespace system (of which there is none) makes finding stuff more painful than it should be. I honestly think Python wins there, even without the php.net/functionname facility.

In general, the only reason I use PHP at all is because the guy running the SCA server won't provide Python, and my web host provides it but it's slower than PHP. PHP is truly ugly, and although I know much less Python, I still prefer the latter.

Of course, Common Lisp is better than all of them...

(Reply to this)


Create an Account
Forgot your login?
Login w/ OpenID
English • Español • Deutsch • Русский…