Python as replacement for PHP?

Paul Rubin http
Fri Mar 5 01:05:50 CET 2004


cookedm+news at physics.mcmaster.ca (David M. Cooke) writes:
> http://python.org/peps/pep-0249.html
> 
> PEP 249 is the DB-API.

That's an informational PEP, which implementations can follow or ignore
as they please.

> Ok, so it's not in the standard distribution -- as you said, there
> aren't any (SQL) database modules in the standard distribution
> [1]. But this is the standard API for database interfacing (and it's
> not a third-party API, either). Most third-party modules conform to
> it (except for weird or old ones).

Yes, but once you add such a module, you're no longer comparing PHP to
Python.  You're comparing PHP to {Python plus some third party package
whose stability etc. you have to evaluate from scratch}.  That's an
issue that people trying to deploy real-world production servers care
about regardless of how much academics and hobbyists tend to brush it
off.

> And hey, if you're choosing a database module, you've got to have
> already chosen a database -- MySQL, PostgreSQL, SQLite, etc. This is a
> bigger choice than "how do I talk to it." The Python DB-API makes it
> relatively easy to write code where the difference in talking to
> different databases is only in your SQL, and not how you call it.

No, the DB-API doesn't help you write code at all.  It's the DB-API
plus it's implementation that lets you write code.  The implementation
doesn't come with Python, so you have to look elsewhere for it.

Look, I'm not exactly singing the praises of PHP; there's lots of
things they could have done right and didn't, and it's nowhere near as
good a general purpose development language as Python.  But it was
written for a specific task that it handles pretty well out of the
box, that Python doesn't handle at all unless you add complex
additional modules maintained by outsiders.  Brushing that off and
saying "Spyce, CherryPy, etc. are all out there, just download them"
is only a matter of degrees better than responding to "Program XYZ is
full of bugs and crashes all the time and the developers ignore
everyone" with "that's no big deal, it's open source, you can fix the
bugs yourself and then it will be fine".



More information about the Python-list mailing list