Settings

Theme

Ask HN: Python or PHP?

3 points by jbarrec 12 years ago · 15 comments · 1 min read


Which language do you prefer and why?*

Python or PHP?

* I am not trying to start a language flame war here. Just trying to see how everyone feels and what their reason is for using their language of choice. I have been using PHP on and off for years but recently learned Python and am curious if it's worth knowing one over the other.

bmelton 12 years ago

The only tangible advantage that PHP has these days is in being able to be deployed pretty much everywhere for fairly cheaply.

If 'cost' is your absolute and only criteria, the answer is probably PHP. If place any other criteria above cost for language choices, the answer is probably Python.

Usually these questions involve more, and are harder to answer, but this one's generally pretty easy. Python.

  • workhere-io 12 years ago

    The only tangible advantage that PHP has these days is in being able to be deployed pretty much everywhere for fairly cheaply.

    I mostly use Python these days, and yet I'd have to disagree strongly that easy deployment is PHP's only advantage. Outside of places like Silicon Valley it's a lot easier to find PHP programmers than Python programmers. On top of that many of the PHP programmers will be relatively cheap to hire. And you can get everything from novice developers to senior developers with a lot of experience.

    • jbarrecOP 12 years ago

      Are there any sites that come to mind that are using Python in the valley? I would love to check them out!

      I am from New York and I really don't hear people talk about Python much. For the short amount of time I've been using Python it has made me want to ditch PHP.

      • bmelton 12 years ago

        Places using Python:

        Google, Youtube, Reddit, Yahoo, Quora, Dropbox, Spotify, Hunch, RedHat, Pinterest, Disqus, Mozilla, Instagram, Punchfork, The Onion (probably DC, not valley), etc.

        • jbarrecOP 12 years ago

          Thank you for sharing! Is there a quick way to identify what sites are running Python? (view source, etc.)

          • bluefin 12 years ago

            There's a browser add-on for both firefox and chrome to quickly check what's powering a site: http://wappalyzer.com/download

          • raquo 12 years ago

            There's builtwith.com - looks at server response headers etc. Doesn't always detect everything because hiding such information is a security advantage for website owners.

          • bmelton 12 years ago

            Hopefully not. For the most part, that list was compiled from either personal experience or networking (E.g., sitting in on a "how we use Python at Quora" discussion at Pycon, for example). Unless one specifically crafts their HTML to say "Powered by Python" or "Powered by Rails" (sometimes people do, but even those aren't necessarily trustworthy), neither Rails nor Django projects are likely to contain any artifacts that would indicate what they were built with.

      • 27182818284 12 years ago

        Dropbox is a huge one. I mean heck, they even hired the creator.

seefriek 12 years ago

For what task? There are things I use Python for; others I use C.

That said...I'd never use PHP for anything I had a say in.

  • jbarrecOP 12 years ago

    Good question. Task => web development.

    • jardaroh 12 years ago

      Go for Python, here is why: PHP is a nice enough language that can do almost every webapp task, however, you will type syntax far more than logic and will shoot yourself in the foot more often then not. Python is a clear and concise language compared to PHP, libraries and modules are often of a higher quality than PHP and can often be understood if you choose to go and look at their code. For developers with PHP experience, PHP is ofcourse easier, I have experience with both languages and have a clear prefference for python due to it's readability.

      If you just want to do a small webapp, Flask is awesome, for a larger more complete framework you should go with Django.

      • jbarrecOP 12 years ago

        Readability is the primary reason I have fallen in love with Python. I will look into Flask and Django!

    • mercnet 12 years ago

      Since you want to learn python and web development here is an awesome tutorial for Flask: http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-... I also recommend checking out codeschool/codeacademy for tutorials related to the web.

      • jbarrecOP 12 years ago

        I am pretty familiar with web development but where I seem to be getting lost is in the MVC frameworks such as RoR, Angular, etc. I'll check out this tutorial right now!

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection