Learn about the Python programming language
The Python programming language is freely available and makes solving a computer problem almost as easy as writing out your thoughts about the solution. The code can be written once and run on almost any computer without needing to change the program.
How Python Is Used
Python is a general-purpose programming language that can be used on any modern computer operating system. It can be used for processing text, numbers, images, scientific data and just about anything else you might save on a computer. It is used daily in the operations of the Google search engine, the video-sharing website YouTube, NASA and the New York Stock Exchange. These are but a few of the places where Python plays important roles in the success of the business, government, and non-profit organizations; there are many others.
Python is an interpreted language. This means that it is not converted to computer-readable code before the program is run but at runtime. In the past, this type of language was called a scripting language, intimating its use was for trivial tasks. However, programming languages such as Python have forced a change in that nomenclature. Increasingly, large applications are written almost exclusively in Python. Some ways that you can apply Python include:
How Does Python Compare to Perl?
Compassionate Eye Foundation/Hero Images/Getty Images
Python is an excellent language for large or complex programming projects. Integral to programming in any language is making the code easy for the next programmer to read and maintain. It takes great effort to keep Perl and PHP programs readable. Where Perl gets unruly after 20 or 30 lines, Python remains neat and readable, making even the largest projects easy to manage.
With its readability, ease of acquisition and extensibility, Python offers much faster application development. In addition to easy syntax and substantial processing abilities, Python is sometimes said to come with “batteries included” because of its extensive library, a repository of pre-written code that works out of the box.
How Does Python Compare to PHP?
Hero Images/Getty Images
The commands and syntax of Python differ from other interpreted languages. PHP is increasingly displacing Perl as the lingua franca of web development. However, more than either PHP or Perl, Python is much easier to read and to follow.
At least one downside which PHP shares with Perl is its squirrely code. Because of the syntax of PHP and Perl, it is much harder to code programs that exceed 50 or 100 lines. Python, on the other hand, has readability hard-wired into the fabric of the language. The readability of Python makes programs easier to maintain and extend.
While it is starting to see more general usage, PHP is at heart a web-oriented programming language designed to output web-readable information, not handle system-level tasks. This difference is exemplified by the fact that you can develop a web server in Python that understands PHP, but you cannot develop a web server in PHP that understands Python.
Finally, Python is object-oriented. PHP is not. This has significant implications for the readability, ease of maintenance, and scalability of the programs.
How Does Python Compare to Ruby?
Todd Pearson/Getty Images
Python is frequently compared to Ruby. Both are interpreted and therefore high level. Their code is implemented in such a way that you need not understand all the details. They are simply taken care of.
Both are object-oriented from the ground up. Their implementation of classes and objects allow for greater reuse of code and ease of maintainability.
Both are general purpose. They can be used for the simplest of tasks like converting text or for much more complicated matters such as controlling robots and managing major financial data systems.
There are two major differences between the two languages: readability and flexibility. Due to its object-oriented nature, Ruby code does not err on the side of being squirrely like Perl or PHP. Instead, it errs in being so obtuse that it is often unreadable; it tends to presume upon the programmer’s intentions. One of the chief questions asked by students learning Ruby is “How does it know to do that?” With Python, this information is typically plain in the syntax. Aside from enforcing indentation for readability, Python also enforces transparency of information by not assuming too much.
Because it does not assume, Python allows for easy variation from the standard way of doing things when needed while insisting that such variation is explicit in the code. This gives power to the programmer to do whatever is necessary while ensuring that those who read the code later can make sense of it. After programmers use Python for a few tasks, they often find it hard to use anything else.
How Does Python Compare to Java?
Both Python and Java are object-oriented languages with substantial libraries of pre-written code that can be run on almost any operating system. However, their implementations are vastly different.
Java is neither an interpreted language nor a compiled language. It is a bit of both. When compiled, Java programs are compiled to bytecode—a Java-specific type of code. When the program is run, this bytecode is run through a Java Runtime Environment to convert it to machine code, which is readable and executable by the computer. Once compiled to bytecode, Java programs cannot be modified.
Python programs, on the other hand, are typically compiled at the time of running, when the Python interpreter reads the program. However, they can be compiled into computer-readable machine code. Python does not use an intermediary step for platform independence. Instead, platform independence is in the implementation of the interpreter.