ask a question at likeplum

Welcome to Hackerpool

The Ultimate Resource for Programming, Webmasters, Graphic Design, and IT

Verified Programmers:  Receive quality work from our verified Hackers.

Privacy options: Choose to make your tasks 100% private.

Post your own Task Become a Hacker
ilovejava ilovejava
Reputation: 27
Asked Jan 18th, 2013 / Closed

some huge websites using Python instead of PHP, why?

Budget: $5.00

I've heard that Youtube and Google(I know Google acquired youtube) are both using Python now. Why?

Facebook is using PHP but it also starts to use Python for some part of it.

Is there a reason?

What's Python's advantage? Is it cleaner and eaiser than PHP?

henrygold member henry
Jan 18th, 2013

Best Answer - Earned: $3.00

  • There are at least three ways of handling errors—return codes, 

    , and exceptions, all of which are handled differently and used inconsistently by functions and libraries, and require messing with various combinations of global settings (such as error_reporting to cause errors display or not display to the user. There are furthermore no agreed-upon conventions for handling errors, so libraries freely mix all of these methods along with directly printing errors to the output which is impossible to trap.  You're out of luck if you want to systematically trap and log all errors and exceptions.
  • Tons of global settings in php.ini that can be different server-by-server.
  • Support for international characters (mbstring and iconv modules) is a hackish add-on and may or may not be installed.
  • Arrays and hashes treated as the same type. Some see this as an advantage, but these are different data structures with different properties and uses. Plus, it's a pain when a function tries to be clever and returns an array with both named and numeric keys—you try to grab the array keys only and get a bunch of numbers in addition to the names.
  • No namespaces, up until recently.  Namespaces in PHP are optional, and all the functions that come with PHP are lumped into the global namespace.  Unlike languages like Python, where you can clearly tell what names have been imported into any file by looking at that file's import statements, in PHP you have thousands of  functions automatically imported by PHP, and more imported by any 3rd party code you are using, and possibility of clashing with any of these at any time.
  • Hash syntax versus class syntax—i.e. 


    —so when you are dealing with data structures that could be implemented either with hashes or stdClass (such as when retrieving values from MongoDB) you have to remember which you're getting, or convert from one to the other
  • Functions/methods always require parentheses e.g. you might have a model Person where 


     are instance variables, but 

     is a method, and you have to remember that whenever calling it and include the parens, even if the fact that it's a function is irrelevant (such as in a view).  Unlike languages like Python, there's no straightforward way to make a method look like a property of a class.
  • Crazy reference model (in PHP4). Even in PHP5, to return an object by reference you have to use an & sign in two different places, on the function signature and on the assignment, lest you accidentally copy an object. See
  • No closures or first-class functions, until PHP 5.3. No functional constructs. such as collect, find, each, grep, inject. No macros (but complaining about that is like the starving demanding caviar.)  Iterators are present but inconsistently used.  No decorators, generators or list comprehensions.
  • A whole bunch of things are considered false: null, false, empty string, zero, the string containing '0', empty array, and who knows what else.
  • The fact that == doesn't always work as you'd expect, so they invented a triple-equals === operator that tests for true equality:
  • If a function returns an array, you have to assign it to a variable before accessing an element, you can't just add an index after the function call.
  • Writing an array literal requires literally writing out the characters a, r, r, a, y, ( and ). Other languages let you use square braces for arrays or curly braces for hashes.
  • Constructors—is it 


    ? Do you call the parent constructor with 


    ? It depends what version of PHP.
  • How do you delimit HTML from output PHP code? 

    <? ?>

    <?php ?>

    <% %>
    ? Well, it depends on some global setting in php.ini.
  • PHP doesn't have multiple inheritance, fine, but it doesn't have mixins/modules, either.
  • There is no such setting as 'use strict', as there was in Perl. Want to have a warning if you mistype a variable name? Too bad, that would confuse the beginners. If you do enable PHP's E_ALL warnings, you get warnings and errors for all kinds of crazy things you don't want warnings for.
  • There is no standard, widely adopted way to create and install modules or code libraries as with Perl's CPAN, Python's easy_install and pip, or Ruby's gems and bundler.  PEAR is pretty bad and hasn't been widely adopted. Libraries are often packaged on an ad-hoc basis (i.e. download a zip file or copy and paste code).
  • PHP is exceptionally slow unless you install a bytecode cache such as APC or eAccelerator, or use FastCGI. Otherwise, it compiles the script on each request.
  • People often abuse 

    . Rather than using it to pull in functions and classes, they use include for actual code execution, often including other includes, creating code that is impossible to follow.
  • Because it is designed to be run in the context of Apache, PHP doesn't work very well as a command-line scripting language, so you end up writing your backend scripts in something else, usually shell, Ruby or Perl. For instance, if you try to create a long-running background process in PHP, you need to remember to override various php.ini settings, or your script may exit after a certain amount of time, have a memory limit imposed on it, or act in other unexpected ways based on limits PHP sets for code running as part of a web request.
  • It can be hard to find where functions are defined. In which of the 50 include files is 

     defined? (In fairness, this horror affects many other languages and frameworks, such as Ruby on Rails)
  • PHP lacks standards and conventions. Whereas all Rails programmers know what goes in app/controllers, what the common rake tasks are, and what the 'rails' command-line tool does, PHP projects are all arranged differently, so you need to decipher each project's unique arrangement and conventions before becoming productive in it. (The same can be said for any programming project in any language that is not based on a framework, so this is not really a unique fault of PHP.)
  • Depending on your server's settings and PHP version, you might have slashes "magically" added to your get and post input:  You may also have global variables magically created based on get and post input:
  • There are a variety of ORMs available all of which suck in different ways, such as bloated syntax, forcing you to write SQL statements as a bunch of function calls (i.e. 

    $something->select('column')->where('condition > 0')->...
    ), or excessive configuration. The one decent ORM (DMZ Datamapper: is maintained by one person, and limited to the Code Igniter framework.
  • There's no standard for processing background tasks, such as Python's Celery, so most PHP programmers put what should be background tasks in controller code.  For periodic tasks, you end up managing separate cron scripts, and dealing with the problems of running PHP code as a shell script, or hacking together a way to have periodic tasks triggered by web requests, which is Wordpress's solution.
  • Because their are so many frameworks, development of add-ons and plugins is a fractured Tower of Babel. An add-on for Code Igniter will not work in Symfony or CakePHP, for example, let alone Wordpress, Drupal, or any of the many CMS's. The ecosystem progresses more slowly because everything has to be programmed multiple times for different platforms. Compare to a language like Ruby, where developers seem largely focused on Rails, or write framework-agnostic Ruby gems that will work with Rails, Merb, Sinatra, or anything else.  Or in a Django project, you can easily 

    pip install some-python-module-or-django-app
     and instantly have new functionality for use in your project.
  • Additionally, the multiplicity of frameworks and coding styles makes it harder to learn from other people's code. With a more widely used framework, when apps or components (controllers, views, libraries) are open sourced, it's possible to visit Github, browse the source of an app, and learn how another programmer approached a problem. With PHP, each site is mostly different, so learning from other people's code can happen, but at the more restricted level of individual functions or classes.
  • PHP has error messages in Hebrew, such as the well-known 

That being said, PHP has a number of advantages for certain types of sites, especially static sites that require a lot of flexibility. The 1-1 correspondence between URLs and files in the filesystem, ease of deployment by uploading or copying files, and the fact that routes, controllers, and the other overhead of a framework is optional makes for a very lightweight, flexible, easy to understand system. If I were creating a site managed by a large team, that was mostly focused on serving diverse static content as opposed to being a web application, PHP remains a good choice.  It's also good for dashing off one-off scripts in situations where time is of the essence and quality is not, such as at a hackathon. 

jebastin9gold member jebastin9
Jan 19th, 2013

Best Answer - Earned: $1.00


i have researched about your question few years back and prepared article. hope that will help you surely.

please find attached document.



jigargatigold member jigargati
Jan 19th, 2013

Best Answer - Earned: $1.00

Python is an dynamic object-oriented programming language that can be compared with Java and Microsoft's .NET-based languages as a general-purpose substrate for many kinds of software development. It offers strong support for integrating with other technologies, higher programmer productivity throughout the development life cycle, and is particularly well suited for large or complex projects with changing requirements.

Python is the most rapidly growing open source programming language. According to InfoWorld its user base nearly doubled in 2004, and currently includes about 14% of all programmers.

Python is being used in mission critical applications in the world's largest stock exchange, forms the basis for high end newspaper websites, runs on millions of cell phones, and is used in industries as diverse as ship building, feature length movie animation, and air traffic control.

Python is available for most operating systems, including Windows, UNIX, Linux, and Mac OS.

Of all types, including Enterprise Application Integration (EAI). Python makes it easy to develop Web services, can invoke COM or CORBA components, calls directly to and from C, C++, or Java code (via Jython), provides powerful process control capabilities, implements all common internet protocols and data formats, processes XML and other markup languages, can be embedded as a scripting language, and runs from the same byte code on all modern operating systems.

from simple CGI scripting to high-end web application development with mega-frameworks such as Django and Turbogears, the Zope application server, Plone content management system, Quixote web application framework, or a even a home-grown solution based on Python's extensive and easy to use standard libraries. Python provides interfaces to most databases, powerful text processing and document processing facilities, and plays well with other web technologies.

benefits from Python's strong integration and text processing capabilities, and Python comes with its own unit testing framework.

Because it has been developed as open source by thousands of contributors from around the world, Python is very well designed, fast, robust, portable, and scalable. With an uncluttered, easy-to-learn syntax and well-developed advanced language features, Python often exceeds the capabilities of comparable commercially available solutions.

The open source license for Python allows unrestricted use, modification, and redistribution of the language or anything that is based on it, commercially or otherwise. Full source is available and there are no license costs. Support is available for free, from a rich set of internet-based resources, and from organizations in the business of providing paid support to Python users.

So we can say that Python is better than PHP, and that is why companies are using Python.


hackerpool is the best place to get Internet and programming tasks help.

Type your task here. Tasks are answered every 9 seconds!

* All work can be made 100% private and is original. Learn more