Python v PHP: fair comparison?

W

walterbyrd

I don't know if this is a fair comparison or not. Any comments
appreciated.

- Python is more readable, and more general purpose
- PHP has awful backward compatibility
- PHP has a lower barrier to entry
- Most inexpensive web-hosters support PHP, but not Python
- PHP has far more pre-writen scripts available
- Newer versions of mod_python require Apache 2.0, which few hosters
have
- There is more demand for PHP developers, than Python developers
 
B

Bjoern Schliessmann

walterbyrd said:
- PHP has a lower barrier to entry

Which kind of barrier do you mean -- syntax, availability, ...?

Also from what I know of PHP, language and API seem more unstable
and inhomogenous. CMIIW.

Regards,


Björn
 
L

Larry Bates

walterbyrd said:
I don't know if this is a fair comparison or not. Any comments
appreciated.

- Python is more readable, and more general purpose
- PHP has awful backward compatibility
- PHP has a lower barrier to entry
- Most inexpensive web-hosters support PHP, but not Python
- PHP has far more pre-writen scripts available
- Newer versions of mod_python require Apache 2.0, which few hosters
have
- There is more demand for PHP developers, than Python developers

For the most part you wouldn't ever thing about writing data
conversion programs, GUI applications, Windows services, COM+ objects,
Linux daemons, simple scripts, socket server/client applications,
etc. in PHP (but all can be done in Python). Web apps are just one of
the many applications that Python can tackle. PHP is normally
relegated to dynamic web page creation and database interfacing of
a web application. I've never seen it promoted as a language
that can be used to develop a standalone non-web browser based
application (but I'm sure someone will tell me that it can be used
that way ;-).

I agree that you can use PHP to do some basic Web apps more
quickly and with more general availability in PHP than Python.
I think there is a reason that Java and Python are used to power
the larger application frameworks that I see (e.g. WebSphere,
WebLogic, Zope, etc.).

I find many hosting companies that have mod_python now (this
wasn't the case a couple of years ago). Hosting costs have
dropped so much during that time that getting Python doesn't
cost much (if any) extra.

I'd be surprised if there was more demand for PHP developers
than Python developers. Google lists 51 PHP jobs and 168
Python jobs in their internal jobs database (I just did a
quick search).

-Larry
 
M

martdi

I'd be surprised if there was more demand for PHP developers
than Python developers. Google lists 51 PHP jobs and 168
Python jobs in their internal jobs database (I just did a
quick search).

Yes, but Google is the company that hired Guido, and that does most of
it's dev in python.

Looking at other companies yields different results:

Workopolis:
PHP 120
Python 36

Monster.ca:
PHP more than 1000
Python 976
 
?

=?iso-8859-1?q?Luis_M._Gonz=E1lez?=

- Python is more readable, and more general purpose

Yes, php is only for web.
On the other hand, Python is a general purpose language and it can be
used for nearly anything you may want to do.
- PHP has awful backward compatibility

Yes. And it's also an ugly language to work with.
- PHP has a lower barrier to entry

I don't think it is any easier than python. Not even to begin with.
- Most inexpensive web-hosters support PHP, but not Python

Sad but true.
- PHP has far more pre-writen scripts available

For web projects, perhaps.
But I'm sure you can do everything better with python, especially with
the new crop of web frameworks (Django, Turbo Gears, etc...).
- Newer versions of mod_python require Apache 2.0, which few hosters
have

You can also get alder versions of mod_python. What's the problem?
- There is more demand for PHP developers, than Python developers

So you want to be a web developer?
Then look no further. Learn python and go kick php developers asses in
the market place.
There are thousands of php developers out there. Do you want to be just
one more?
I'd rather learn something newer, and much more powerful.
And once you get a job, you will do everything better and faster than
the others, your quality will stand up from the rest and so your
reputation.
Then there will be more demand for "your skills".
 
M

Michael Torrie

Yes, php is only for web.

Absolutely false. Most of my standalone, command-line scripts for
manipulating my unix users in LDAP are written in PHP, although we're
rewriting them in python.

Although I can't think of a single app written in php that's not web-
based (other than standalone scripts I have written), there are up-to-
date php bindings for GTK: http://gtk.php.net/

Michael
 
?

=?iso-8859-1?Q?Luis_M._Gonz=E1lez?=

Yes, php is only for web.
Absolutely false. Most of my standalone, command-line scripts for
manipulating my unix users in LDAP are written in PHP, although we're
rewriting them in python.

Although I can't think of a single app written in php that's not web-
based (other than standalone scripts I have written), there are up-to-
date php bindings for GTK: http://gtk.php.net/

Michael

Fair enough, this has been possible due to the enormous popularity of php.
You can also hit a nail with your shoe instead of using a hammer, and if you
try hard you may even succeed. You can also digg a a grave with a spoon
instead of a shovel, and after a couple of days you'll be finished.
You may be able to use php to create a stand alone app, but php was created
with the solely purpose of being a tool for creating dynamic web sites.
And you have to admit that using php for a non-web app is like trying to fit
a a square into a round hole.
Php is no more than a simplified C-ish language, dynamically typed with a
lot of functions aimed at web tasks. Without these built-in functions,
there's little you can do with it in your web apps.
On the otehr hand, you don't need a thousand built-in functions in python
for achieving every single task on a web site. You just write them, often
with just a couple of lines, because the language is that flexible an
consice.
You don't have to remember each and every function for every task, this is
ridiculuous.

I think that even as a general purpose language, python is still much more
adecuate, fast, fun and flexible than php for building web apps.

Luis
 
H

Hendrik van Rooyen

Olexandr Melnyk wrote:

PHP has a lower barrier to entry

I don't think so. Python has more intuitive syntax for beginners and is one of
the best choices for the first programming language to pick up.

I second this - before discovering Python (in a GSM module's guts) - I was being
steered in the direction of PHP by a friend - and I resisted, kicking and
screaming, as I found the syntax weird - I believe its not called Personal Home
Page for nothing...

- Hendrik
 
W

walterbyrd

Luis said:
the new crop of web frameworks (Django, Turbo Gears, etc...).


You can also get alder versions of mod_python. What's the problem?

The problem is that the system requirements for django and turbogears
are sky-high. I think Django requires Apache 2.0 (and maybe mod_python
3.x), and CherryPy (part of turbogears) requires Python 2.4. If you are
developing for a hosted environment, this can be a big problem. Few
enough hosters provide python to begin with, then add to that such
requirements as apache 2.0 - and you left with almost nothing.
 
W

walterbyrd

Larry said:
I'd be surprised if there was more demand for PHP developers
than Python developers.

Prepare to be surprised. From what I have seen demand for PHP
developers is off-the-scale higher than demand for Python developers.

If you search the job boards, then -IMO- it is only fair to not include
jobs where the language is listed as an also-ran. For example a typical
sys-admin job will list about 24 skills, and python is often thrown
into the landry list. To my way of thinking, that is not really an ad
for a python developer.

Trying to be as fair as I can be, my research shows that demand for
developers where PHP is the primary is *far* higher than jobs where
Python is the primary skills.

Of course, at best, that only shows the demand part of the equation.
There is also the supply side to consider. From what I have seen for
salary offers for PHP developers, it may be fair to say that PHP
developers are a dime a dozen.
 
W

walterbyrd

Bjoern said:
Which kind of barrier do you mean -- syntax, availability, ...?

Putting php into a web-site is as easy as throwing some php code into a
my html file, and maybe giving the file a php extension. I can get php
hosting for $10 a year easy.

This may not be what you want for a major developement project, but the
barrier to entry is very low.
 
P

Paul Boddie

walterbyrd said:
The problem is that the system requirements for django and turbogears
are sky-high. I think Django requires Apache 2.0 (and maybe mod_python
3.x), and CherryPy (part of turbogears) requires Python 2.4. If you are
developing for a hosted environment, this can be a big problem. Few
enough hosters provide python to begin with, then add to that such
requirements as apache 2.0 - and you left with almost nothing.

I guessed that this was what you meant by "PHP has a lower barrier to
entry", even though others chose to interpret that in the context of
how easy or consistent the technology would seem to be in comparison
with Python. While it's true that PHP seems to be widely available, and
the newcomer can probably get immediate results by just publishing a
few files, the availability of relatively inexpensive virtual server
hosting seems to undermine claims that no-one supports Python together
with a modern selection of server programs.

I've been tempted to get some "dynamic" hosting at some point, and the
major difference between now and the last time I looked into this
(possibly about three or so years ago), is that back then you had to
spend a fair amount of money to get anything other than an
inconveniently accessible CGI directory requiring a version of
cgipython that could run on the inconveniently chosen version of
FreeBSD so beloved of certain hosting providers. Now, you can get a
virtual server populated with your own GNU/Linux distribution, or if
that sounds like too much work, there's a choice of hosting providers
that support Python plus certain servers "out of the box".

Things seem to have moved on, and very much for the better, too.

Paul
 
W

walterbyrd

Michael said:
Absolutely false. Most of my standalone, command-line scripts for
manipulating my unix users in LDAP are written in PHP, although we're
rewriting them in python.

I would say that you are one of very few who use PHP for sys-admin
tasks - and even you have switched to Python. In general, it does not
seem to me that PHP has caught on as a sys-admin language.

However, as sys-admin scripting langanges go, I would also say that
Python is far less popular than butt-ugly Perl. Again - just based on
what I've seen.
 
A

Andy Dingley

walterbyrd said:
I don't know if this is a fair comparison or not.

Who cares? Anything involving PHP is a "billion flies can't be wrong"
type of statement.

I agree completely with your observation about PHP's lower cost of
access. This is ostensibly a good thing, but it also means that every
software-ignorant newbie dives straight into PHP and ten minutes later
they're a guru. The average quality of PHP developers is rock-bottom
and the average quality of PHP code is about the same. I don't like the
language either, but it's the use PHP is put to that spoils most of it,
more than language features itself.
 
J

James Cunningham

[...]
That's true, but I was lucky enough to find webfaction.com for python
hosting, including Django. Good prices and they know Python. I think
they used to be python-hosting.com or something.

-Jeff

Dirt-cheap Dreamhost also offers Python with Django (as well as Ruby
with Rails), though I haven't used those capabilities so I can't judge
how good the environment is. I suspect it isn't that great. The people
at Dreamhost are great; the service itself is - at best! - unreliable.

Best,
James
 
T

tobiah

I've wrestled with this for quite a while, and I think
that I've come up with a solution. Let the heavy lifting
of the application be done with a back end python process.
I was thinking that I might use cherrypy to sit there and
wait for requests.

Then, I would have PHP make calls to this back end process
to get the content that it needs. This could be on any level
from a simple datum from the database, or as complex as
the HTML for the entire web page. I'm still trying to settle
on a protocol (SOAP, CORBA?) but I think that it should be
at the object level rather than simple posts to cherrypy.

Anyway, even though not all web hosters have a reasonable
python web framework installed, they will almost certainly
allow you to run python programs. The PHP might eventually
boil down to simple function calls that get content from
the back end. Let python do all the work:

<?php

put_attendee_mailing_info($id);
list_cart_items($id);

?>
 
?

=?iso-8859-1?q?Luis_M._Gonz=E1lez?=

walterbyrd ha escrito:
The problem is that the system requirements for django and turbogears
are sky-high. I think Django requires Apache 2.0 (and maybe mod_python
3.x), and CherryPy (part of turbogears) requires Python 2.4. If you are
developing for a hosted environment, this can be a big problem. Few
enough hosters provide python to begin with, then add to that such
requirements as apache 2.0 - and you left with almost nothing.

You are right.
Although this is not a problem to me, because I just use bare-bones
mod_python, with no framework on top of it.
Not many people know that mod_python comes with its own built-in
handlers suitable for different programming styles, such as PSP
(similar to php) or publisher (M-V-C style).

Luis
 
B

Bruno Desthuilliers

walterbyrd a écrit :
Putting php into a web-site is as easy as throwing some php code into a
my html file, and maybe giving the file a php extension. I can get php
hosting for $10 a year easy.

This may not be what you want for a major developement project,

Not even for a minor one. While one can write not-trivial applications
in PHP, the kind of work this requires would greatly benefit from a real
programming language (vs a Q&D web scripting language).
but the
barrier to entry is very low.
Ok. This observation is very specific to web development. Python is a
general purpose programming language. And from this POV, it's IMHO much
easier to learn. And not only because you don't need Apache to use it.
 
B

Bruno Desthuilliers

walterbyrd a écrit :
Larry Bates wrote:




Prepare to be surprised. From what I have seen demand for PHP
developers is off-the-scale higher than demand for Python developers.

Anyone that knows how to program and understand the http protocol is
already a PHP developer.
If you search the job boards, then -IMO- it is only fair to not include
jobs where the language is listed as an also-ran.

Then you'll find *very* few "Python developper" jobs.
For example a typical
sys-admin job will list about 24 skills, and python is often thrown
into the landry list. To my way of thinking, that is not really an ad
for a python developer.

No, it's an ad for a sys-admin job.

FWIW, I've been hired as a web developer - not as a PHP or Java or
whatever specific language programmer. Python wasn't even on the "landry
list". Then we had to hire another developer to help me on a Zope-based
project. We didn't hired a "Zope developer", nor even a "Python
developer" - we hired a young C/Perl hacker with almost no prior web
programming knowledge. Why ? Because he obviously was the best
*programmer* we could find. As a matter of fact, he managed to become a
productive Zope/Python programmer in less than two weeks.
Trying to be as fair as I can be, my research shows that demand for
developers where PHP is the primary is *far* higher than jobs where
Python is the primary skills.

There are companies that believe that there are such things as "PHP
programmer", "Java programmers", etc. And there are companies that know
the difference between a programmer and a code-monkey. The first one
will ask for 10+ years of experience on a techno that is less than 5
years old. The other will know a good coder when they meet one. Guess
where are most 'Python programmers' working ?
Of course, at best, that only shows the demand part of the equation.

Not even.
There is also the supply side to consider. From what I have seen for
salary offers for PHP developers, it may be fair to say that PHP
developers are a dime a dozen.

Anyone that knows how to program and understand the http protocol is
already a PHP developer.
 
C

Carl Banks

walterbyrd said:
Trying to be as fair as I can be, my research shows that demand for
developers where PHP is the primary is *far* higher than jobs where
Python is the primary skills.

Probably because PHP is so bug-prone and man-inefficient that a small
website occupies a programmer's whole time, whereas a single Python (or
Ruby, or Perl, or even Java) programmer could manage several web sites.

(If by "probable" I mean "wishful thinking", that is :)


Carl Banks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top