Why Python?
Erik Price
erikprice at mac.com
Wed Sep 4 10:17:26 EDT 2002
On Wednesday, September 4, 2002, at 09:50 AM, Konrad Wojas wrote:
> I've been doing web development in PHP since 1998 and have written a
> content
> management system with a quite complex shopping cart system and a
> backoffice system to handle all sales. It's over 10000 lines of PHP
> code,
> excluding the html code.
I learned to program from PHP, and wrote an application that was
comparable (somewhere over 10,000 lines of code). It didn't deal with
e-commerce but was essentially an extensive database front-end, and
included shopping cart-like "features".
> I've really had it with PHP, it's unmaintainable, ugly and slow.
> Errors like
> 'parse error on line 487' are not fun to work with. I really like
> python.
> The systax is a lot clearer, exceptions are great and I really love
> those
> stacktraces if an exception is not handles. Object oriented
> programming in
> PHP is a joke, it really sucks. And PHP is buggy. I've encountered
> numerous
> bugs, especially in the extension modules. XSLT in PHP? Forget it, the
> module will crash in 50% of the cases. And compiling PHP yourself with
> a
> lot of extension modules can be a real nightmare. And above all:
> python is
> a generic language, PHP is only useable for web development and small
> maintainance scripts. It doesn't have bindings for anything beyond web
> development.
I think that PHP is prettier than Perl but not nearly as pretty as
Python. Its support for objects is adequate for some purposes, but for
a fully object-oriented application it might not be quite up to snuff.
If your code is mostly procedural and you use a few objects to make
your life easier, though, you should be able to manage.
The error messages from PHP were always fine for me, but there's no
elegant way to handle them like in Python where you can catch
exceptions, etc.
PHP does have a few kinks, but the bugs are esoteric. It is a pretty
well-developed language IMO. One of the biggest differences between
PHP and Python is that in PHP most of the functions are built into the
global namespace. I know that some people in Python have a lot of
problems with that, but PHP is not a general-purpose language and so
doesn't use modules like Python and Perl -- having these functions
available is actually a blessing. But in a language like Python or
Java I prefer the modular approach.
PHP also has extremely good interconnectivity with the MySQL database,
so many people who use MySQL see PHP as the web-language of choice.
PHP/MySQL tutorials and books abound, which I think is interesting
because there are so few jobs (in New England, US at least) that
actually want PHP programmers.
> I'm still maintaining the PHP code I have written, but I use python
> for all
> new projects. Don't start big projects in PHP, you'll regret it ;-)
I would go back to PHP for some simple dynamic web page scripts, but
not much more. I agree with the above -- if you're going to write
full-blown applications, you will probably like the OO facilities of
Python (or Java) better.
Erik
--
Erik Price
email: erikprice at mac.com
jabber: erikprice at jabber.org
More information about the Python-list
mailing list