php vs python

Diez B. Roggisch deets at nospam.web.de
Mon May 26 08:25:16 EDT 2008


> If you hate PHP, that's OK, but it doesn't make PHP a bad or even
> inferior language.

No. That is PHP on it's own that makes it an inferior language. It is suited
(and surprisingly well) for the task of creating webapps. But the language
core? Plain ugly. Examples include (in arbitrary order and not complete)

 - bolted-on Object-system 
 - lack of binary extension API 
 - ONE collection type to rule them all!!
 - stateful collection iteration (come *on*, calling reset on an array!)
 - no namespaces (according to
http://www.php.net/manual/en/language.namespaces.php they are planned -
good)
 - copy-by-value semantics with a crude reference-mechanism to mitigate that
 - inconsistent APIs all over (DB-connectivity for example). Yes, I know
about PEAR::DB. But somebody "designed" the real DB apis. Or actually
didn't. Which 
 - no concept of higher order functions - you pass around function-*names*.
Which of course works because of one flat namespace. Wonder how it will
work if NS get real

Oh, and one of my real favorits: NO SUB-EXPRESSIONS. You can't write

$foo = $array1[$key1][$key2][$key3]

I'm wondering how to write a language that *doesn't* allow for that...

And before you ask: yes, I've written PHP, more than enough and larger
systems in it with a few K-loc. I even encountered weird bugs (PHP 4.0.x,
has been a while) that made PHP forget function definitions! You could
re-load a page if a function was missing, and it magically appeared. and
you could *fix* this turning off some warn/log-level. Again - I don't even
*know* how to program something like a language that behaves that way. And
it certainly puts the language into the worst light imaginable. buggy
libraries and extensions? No deal, can happen. But core features like
that - should work.

having said all this - I see the benefits of PHP. It is easy to start for
non-programmers, you can get it for virtually no cost at all for
web-development tasks, you don't need to bother with stuff you have to deal
in python web-frameworks like setting up mod_wsgi, mod_python or mod_proxy.

But it is a hack. Don't pretend otherwise.      

Diez



More information about the Python-list mailing list