

Python or PHP? - abhishekdelta

I've been a web developer for a long time but I'm still stuck with this one big question. I really love PHP, esp. its fast overall development and deployment cycle. But people I meet have been arguing with me to switch to Python, which I'm yet unsure of. I remember having seen somewhere that Python is even less efficient performance wise. So why should I (if at all) move to Python?
======
knieveltech
You'll learn something, additional career opportunities (maybe) and improved
prestige among the developer community (guaranteed) come to mind.

It never hurts to have more than one language in your quiver. If you're
looking for work and are having a hard time finding a PHP gig that suits your
fancy, having some other language dialed to the point you can code in it
professionally increases your odds of finding (and keeping) a job.

Of course, I make a good living coding PHP for high end websites, and have
been for years now. I just don't talk a whole lot about the language that pays
the bills since invariably mentioning PHP is your primary language leads to a
torrent of hot air from other developers who use "cooler" languages.
Personally, I think it's all bullshit and if folks want to play "cool kid"
with their language of choice, that's fine, but don't expect me to play along.

Fun fact: the highest paid programmer I've met to date coded exclusively in
COBOL. Think monster 1099 rates consulting on legacy mainframe code overhauls.

~~~
abhishekdelta
You're like me. And yes I haven't found a single strong reason to move to
python. Technically, is there anything good about Python as compared to PHP,
other than being a 'cooler' language ?

~~~
knieveltech
"Good" is a subjective term. Python's strengths have been enumerated ad
infinitum by smart folks with a lot more experience with the language than I
have. Personally, I generally prefer perl for the kind of tasks I'd typically
consider python for, but that's more to do with my dislike of being told how
to do things than any particular weakness in python.

A lot of programmers really enjoy that additional structure and I have to
admit that when it comes to reading someone else's source, Python typically
makes for a more enjoyable experience than Perl.

At the end of the day it's up to you to decide if Python has any value for
you, and the only way you're going to find that out is to take it for a test
drive.

------
zoowar
General performance comparison. [http://shootout.alioth.debian.org/u64q/which-
programming-lan...](http://shootout.alioth.debian.org/u64q/which-programming-
languages-are-fastest.php?calc=chart&python3=on&php=on)

~~~
igouy
ftfy
[http://shootout.alioth.debian.org/u64q/benchmark.php?test=al...](http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=php&lang2=python3)

From the "≈ CPU Load" we can see that:

\- regex-dna - the Python program was written for multi-core the PHP program
wasn't

\- spectral-norm - the Python program was written for multi-core the PHP
program wasn't

\- k-nucleotide - the Python program was written for multi-core the PHP
program wasn't

\- mandelbrot - the Python program was written for multi-core the PHP program
wasn't

\- binary-trees - the Python program was written for multi-core the PHP
program wasn't

So it would be better to compare the programs forced onto one core, and that
shows the PHP programs compare well to the Python programs -

[http://shootout.alioth.debian.org/u64/benchmark.php?test=all...](http://shootout.alioth.debian.org/u64/benchmark.php?test=all&lang=php&lang2=python3)

~~~
cptskippy
>it would be better to compare the programs forced onto one core

How is that fair? Python has true multi process capabilities where PHP does
not. You can run Django and other web frameworks in multi process modes that
would spread load out better utilizing system resources. This isn't true of
PHP, from what limited knowledge I have.

While they're comparable under a single process, PHP does not scale nearly as
well as Python does.

~~~
xd
I don't understand why you felt the need to comment when you say yourself
"from what limited knowledge I have".

PHP and Python both have "true multi process capabilities". It's called
forking. I think you are confusing forking with threading.

------
maratd
Stick with PHP. You already know it. With PHP-FPM you can easily scale PHP to
multiple cores and have a stable FCGI interface. There is nothing Python can
offer you that PHP can't.

