What is Python?
Python is an object-oriented programming language devised in the late 1980s. Now on version 3, it's still popular with programmers.
Named after Monty Python's Flying Circus, a 1970s BBC TV comedy series, Python's creators designed the language to be enjoyable for programmers to use.
The variables "foo" and "bar" are often used in documentation of programming languages, but in Python, the same demonstrations are generally written with variables named "spam," "ham" and "eggs."
Mixed Programming Paradigms
Python is ideal for those who like to mix an object-oriented approach with structured programming.
It's also designed to be easily read and understood by novices thanks to a very simple stylistic form and grammar.
The code is intentionally written very clearly and concisely and is easy for inexperienced programmers to review and change.
Where many languages use punctuation, Python leans towards using English words, making any given file less cluttered visually.
It is also clearly indented when written to make the code easy to scan.
Python's functionality can be extended with add-on functions written in C or C+, and it can also be used as a command language with C.
Code can also be run from within a Java application, allowing Java variables to be called from within Python and re-used.
Python is Easy to Learn
Compared to languages that appear impenetrable to the novice, Python is considered to be easier to learn, and its cross-platform compatibility is one of its major benefits.
It can be coded in the Terminal app on macOS but is also often used for security applications, or web applications running on a Unix or Linux server.
The language is employed by YouTube, Google, and NASA, as well as CERN, the home of the Large Hadron Collider.
CERN uses Python to decode data from Atlas, one of the LHC sensors. The CERN staff also host Python conferences and uses Python extensively in their physics and computing labs.
Python Versions and Releases
At the time of writing, Python is running on version 3.8.1, released on December 18, 2019.
If you want to familiarize yourself with the programming language, exploring various Python versions and their respective updates can give you an idea of what to expect.
Here is a summary of Python's ten latest updates, mainly consisting of version 3, with a single update for version two:
|Python 3.8.1||December 18, 2019|
|Python 3.7.6||December 18, 2019|
|Python 3.6.10||December 18, 2019|
|Python 3.5.9||November 2, 2019|
|Python 3.5.8||October 29, 2019|
|Python 2.7.17||October 19, 2019|
|Python 3.7.5||October 15, 2019|
|Python 3.8.0||October 14, 2019|
|Python 3.7.4||July 8, 2019|
|Python 3.6.9||July 2, 2019|
Python Is Well-Established
If you're venturing into coding with Python and creating a Python application for the first time, there is a wealth of support available.
Python is used by some of the biggest sites on the internet, despite having a reputation for being "slow" compared to other languages, and there are numerous web resources, tutorials, online classes, and books which will get you started quickly.
Take Care in Hosting
There are lots of options if you're looking for Python hosting, but some care is needed.
Make sure you select the right plan and really drill into the details of your preferred host's Python offering before you sign up for a long-term hosting commitment.
Python Is Ideal For Web Apps
Python is extremely adaptable, and there aren't many limits to what it can do.
Why Python Is So Good
It's ideal for web development because it's quick to write (there's a lot of built-in support for things like HTTP and MySQL database integrations) yet can be used in advanced, sophisticated applications.
All kinds of companies, from BitTorrent to YouTube, have used (or currently use) Python, and it plays a part in processing some of the most cutting-edge scientific data on Earth at NASA and CERN.
Its versatility and simplicity make it an ideal choice for web apps as well.
|Clean syntax||Easy to learn Python and write code|
|Cross-platform||Runs on different server operating system|
|Used by big companies like YouTube, Google, NASA, CERN||Language has a lot of support|
|Lots of frameworks available||Easy to develop Python applications|
There is an abundance of well-written Python web frameworks, such as Django, TurboGears, web2py, Flask (which is technically a microframework), and Pyramid. With these, you can code web applications without worrying about how to handle low-level details, such as protocols, sockets, or process and thread management.
These server-side frameworks require explicit support, so if you opt to use one, be sure that your web host supports it as well.
If you're new to running Python on the web, you might want to check that your host offers Python tech support for free — just in case you need a hand getting things set up in the beginning.
Warning: Some Hosts Don't Offer Python
Naturally, you should ensure that Python is installed on your chosen web host's servers and that it can handle any file you upload before you sign up.
Some hosts, particularly those who offer shared hosting, don't offer it at all.
Python Can Slow Down Servers
That's usually because inexperienced programmers can slow an entire server by coding their Python app inefficiently, bringing down other customers' sites in the process.
Malicious programmers could cause problems in a shared environment since mod_python isn't locked down as tightly as mod_php on Apache.
Check for Framework Support
When looking for Python hosting, check for support for frameworks such as Flask and Django.
Ascertain the version of Python and mod_python the web host is running.
Python 2 and Python 3 are quite different, and you may find the version your host has installed currently is not entirely backward-compatible.
You'll also want to dig deeper into the specifics — some web hosts limit your use of Python to selected situations only.
Check the interpreter that your host is using and make sure it's suitable for your needs.
Some interpreters are out-dated, and requests for an upgrade may fall on deaf ears.
Ensure you have shell access and that the Apache installation supports CGI and mod_wsgi, as well as anything you need for your web framework.
Check Python Modules
It's also worth checking the host's policy on Python modules.
Some Python web hosts are happy to install whatever you need and will do so relatively quickly — for example, within 24 hours.
Other hosts may have policies around which modules they will allow, and they will refuse to install anything that's unproven or untested.
Also, check that your host will allow you to run persistent processes (sometimes called 'long-running processes') on its servers, particularly if you have your heart set on a cheaper plan, such as a shared hosting plan.
Many hosts don't allow such processes because they are, by nature, resource hogs.
Even if you have a shared hosting plan offering unlimited resources, your web host may consider your apps more appropriate for a VPS plan or dedicated server and terminate your contract accordingly.
If you need to run persistent processes, you may be best off investing in a virtual private server (VPS) instead, or you may just want to bite the bullet and get a dedicated server — an expensive option, but one which will allow you to code whatever you like, however you like.
Dedicated Servers Require Maintenance
Be wary, however, of opting for a dedicated server if you don't want to spend time fixing things on your server that you accidentally break along the way.
Again, we want to reiterate that a virtual environment offered by a VPS plan will save you from this kind of trouble, or you might consider looking into a managed plan that supports custom coding.
Special Python Plans
If you want to exclusively code in Python or base a large amount of your coding around it, it's best to personally email the host before signing up for a contract.
They may have a special plan for Python at a reasonable cost that gives you more freedom and flexibility.
How To Check Your Python Version On Windows, Linux, and Mac
You may want to check your machine's Python version for a variety of reasons. Here is how you do so for Windows, Linux, and Mac.
Open your command line (Windows, Linux) or terminal (Mac):
- Linux: Hit "Ctrl-Alt-T or Ctrl-Alt-F2
- Windows: Press "Win+R" > type "powershell" > Hit "Enter"
- Mac: Go to "Finder > Applications > Utilities > Terminal"
Once your command line or terminal is open, enter the following text:
- Windows/Linux: python -version
- Mac: python -V
(On the Mac command line, make sure the "V" is capitalized.)
The version will display as 3 digits separated by two dots in the middle, like: Python 3.8.1
Via Your Control Panel
What about when you want to check your server's machines Python version?
When you log in to your hosting control panel, you might expect to see a "Python" sub-menu, but you won't.
Your best bet when you use cPanel or Plesk is to simply search for the term "python" and see what results you get. Unfortunately, changing your Python version isn't like changing your PHP version.
Providing you have root access, you can use the Command Line method outlined above.
Choosing a Host
The best option for Python is a dedicated server.
While it's an expensive option, a dedicated server comes without limitations so that you can take control of your Python install.
Second Best: VPS
If you don't want to go dedicated, you would be best off with a Virtual Private Server (VPS), rather than a shared hosting plan.
In fact, most hosts won't support Python on shared hosting, since it's too easy for inexperienced coders to bring a server down unwittingly, and because running Python apps can be a resource drain.
Things to Remember
When choosing a web host for Python:
- Make sure that your chosen package has Python support in the specs.
- Check the Python interpreter version, since a host may be reluctant to update an old interpreter if there's little demand.
- Ascertain which modules are installed, and what the policy is regarding new modules.
- Check on whether you can install Python packages, which are directories of Python modules, by yourself.
- Make sure your host will allow you to run persistent processes; on shared hosting, this is unlikely.
- Check that you have Shell (SSH) access.
- Check what your options are when it comes to databases — you can expect Python scripts to play well with a MySQL database, generally speaking, but if that's not an option, you'll need to do a bit more digging.
If you plan to spend a lot of time working with Python, look for a host that specializes in it, rather than going for the cheapest host and hoping for the best.
In the long run, you'll find it's far easier to pay slightly more for a host that's supportive and keeps their Python install up to date.
Additionally, the host will expect you to run persistent processes and won't penalize you for it.
My Choices: The Top Three WordPress Hosts
|Host||Plan Types||Starting Price (Dedicated Servers)|
|A2 Hosting||Shared, WordPress, VPS, Dedicated, Reseller||$99.59/mo|
|LiquidWeb||WordPress, Cloud, VPS, Dedicated||$109.00/mo|
|InMotion||Shared, WordPress, VPS, Dedicated||$105.69/mo|
A2 Hosting Python knowledge base
Because Python hosting is somewhat niche, we simply looked for hosts that offer full support for Python, multiple frameworks, and use of modules/packages, as well as availability of support (both in terms of tech support and online documentation) in case you run into issues with any of these items.
LiquidWeb Hosting Python knowledge base screenshot via WhoIsHostingThis
Other hosts we looked at, including SiteGound, iPage, and GoDaddy, all offer some support for Python, but there were either strict limitations on what could be done, or we felt that support was a mere afterthought.
InMotion Hosting Python knowledge base
Pros and Cons
Python is used by all kinds of companies and organizations, including Google, NASA, and CERN.
The Large Hadron Collider (LHC) decodes its critical ATLAS data using Python. So there are many reasons to use it. But there are cons too.
- It supports HTTP and MIME out of the box, so you can get up and running with your web apps written in Python faster
- You can code extensions in C or C++
- Python can be run from Java applications
- Programmers can easily connect to databases to bring content into their projects
- There are tens of thousands of pre-made, freely available packages to speed up development and potentially cut costs.
- It can be difficult to spot mistakes in your file until it's time to run the code, which makes debugging cumbersome
- It can be slow, so you'll need a speedy host to compensate
- Unless you're an experienced developer, learning Python solo is a challenge
- Hosts that have Python installed may not be able to help you if you run into a technical problem - a lot of hosts stipulate that they support Python-based applications, but their support team does not cover malfunctions as a result of your code
- Few hosts will provide Python support for a shared hosting plan, which means you will have to opt for the more expensive VPS hosting plan or dedicated server. As such, this is not a cheap undertaking.
Looking for a great deal on Python hosting?
A2 Hosting scored #1 in our recent speed and performance tests. Their Python hosting plans come with unlimited storage and transfer and an "Anytime" money-back guarantee. Save up to 50% on these plans by using this discount link.
Despite the fact that the Python programming language is commonly-used by entities both small and large, web hosting for websites and apps utilizing Python can be hard to find.
There are lots of reasons for this, but the bottom line is that you'll probably pay a premium to get the hosting environment you need.
Other features in Languages and Frameworks
- .NET Framework
- Ruby on Rails
- Server Side Includes
- PHP 5
- PHP 7
Python Frequently Asked Questions
- What is Python?
Python is a free, open-source programming language that was originally released in 1991 by the Dutch programmer Guido van Rossum. It is a highly dynamic object-oriented programming language and is used for rapid application development.
- What is Python used for?
Python is often used for web development, though it has many other purposes too. It was originally designed to help with system administration, and can now be used to make applications, analyse data, and more.
Python is a general purpose programming language.
- What is the best development framework for Python?
The most popular Python web application frameworks include Django, Flask, Pyramid, and CubicWeb. Other frameworks that are popular amongst Python application developers include Web2py, CherryPy, and TurboGears.
There is no best development framework, and choices depend on developers' preference and purpose.
- Why is Python popular?
Python is popular due to it's user-friendly design and shallow learning curve. Despite the relatively complex tasks one can use Python for, it is easy to learn.
Python is not as widely used as PHP, but it's well-documented, and there are lots of modules available to make coding fast and fun.
- Is Python used for web development?
Yes, Python is popular amongst web developers building websites.
Initially, it might be more sensible to use something like WordPress or Drupal, and then code your own plugin in PHP. That will give you a significant head-start, compared to coding something from scratch.
- Why is Python recommended for beginners?
Python's syntax contains a lot of English words and is relatively easy to read, even if you don't know how to code. It is included on Linux and Mac systems, so there's little complexity involved in getting started.
Many Python programmers begin by writing small scripts for their own computers. Python also includes a built-in web-server, so you can run a web app locally as you are developing it.
- Is Python available on shared hosting plans?
Python can come with some shared hosting plans, but it isn't a standard feature by any means. If your sole purpose of buying a hosting account is to learn Python, check the fine print very carefully before you sign up.
- What do I need to look for in Python hosting?
When looking for Python hosting, find a plan that specifically mentions Python in the technical specifications; don't assume that it's provided, because not all hosts offer it. A VPS or a dedicated server is a safe bet.
Additionally, make sure that you have the version, modules, and libraries you need because different versions of Python aren't fully compatible.
- What is mod_python?
In basic terms, mod_python is a module within Apache that allows Python code to run on the web server. This is one of the most efficient ways to run Python. mod_python servers as an integrator of Python with the web server and was written by Aaron Watters.
- What is a Python module?
A Python module is a script that allows you to complete a specific task. A package contains a bundle of modules and a file named __init__.py.
You can download packages from the PyPI repository, and your host will already have some modules installed that you can use. However, some hosts will refuse to install modules on demand. Check the fine print in your host's Terms of Service if this could be an issue for you.
- What are the alternatives to Python?
For writing web applications, the two most popular alternatives are PHP and Ruby. For desktop utility scripting, you could try Ruby, Perl, or Bash.
Other alternatives include Java (object-oriented language), NodeJS, and Scala (also object-oriented).
- Should I use Python or Ruby for my project?
If you are a true beginner, and you just plan to develop one or two things, Ruby (with Rails) is probably a better choice than Python. If you are interested in experimenting and building your skills as a coder, go with Python from day one.
That said, Python's learning curve is generous and beginner-friendly, especially considering the complexity of code you can achieve and build with it.
- Is it easier to use PHP rather than Python?
But more people learn PHP, because it's more widely used and supported, thus it can be 'easier' to learn. In technical terms, Python is considered to be superior to PHP, and more suited to 'serious' projects.
There are also many frameworks available for PHP (including Laravel, CodeIgniter, and Zend), and PHP allows you to work with the web's most popular CMSs, including WordPress.
- What are the differences between Python v2 and Python v3?
The code syntax is slightly different in Python 2 and 3. Some keywords are different, and some people feel that Python 3 is slightly slower, although many variables can affect speed.
If you want to install an existing Python application, it's important that your host supports the correct version, since it's difficult to switch between the two versions.
- What server is best for Python?
Popular web servers include Apache HTTPD and Nginx, while widely used application servers include Django, Tornado, Twisted, and Gunicorn. There are dozens of Python web servers/frameworks, many of which are open source.
There is no one best choice for a Python server and your choice will also be determined by what you want to do with Python.
- Is Python used for frontend or backend?
As a general purpose programming language, Python can be used for both front and back-end development. By front-end, we mean user-facing, and by back-end we mean core fundamentals which the user cannot see, nor directly experience. Nevertheless, Python is primarily used on the server-side, the back-end.
- Can Python be used for Web applications?
Yes, Python can be used to build server-side applications. It is a common programming language choice to build web applications among web developers due to it's relative simplicity and efficiency as a programming language.
Python is also popular with Java app developers and newcomers alike.
- How does Python interact with HTML?
An example interaction between the two languages would be when you perform a Google search via a HTML-built website, and that action eventually interacts with multiple servers (and Python code) to gather your desired information.
HTML is a mark-up language and is used to architect a static website that displays various elements in preset arrangements, while Python is a server-side programming language.
- Is Python faster than C++?
It is generally thought that C++ is faster than Python. This is understandable when we consider Python is partly written in C, and that Python needs to be compiled, while C++ is pre-compiled.
However, Python is still a popular choice due to cost efficiency and simplicity as a programming language.
- What companies use Python?
As a remarkably effective general puprose language, Python is used by some of the largest global companies like Instagram, Google, Spotify, Dropbox, Uber, Quora, Netflix, and Reddit. Many games have been built using Python too, including Battlefield 2, Civilization 4, and QuARK.
- What is Python used for at Google?
At Google, Python as an official programming language alongside two others, Java and C++. Part of Google's search algorhithms are written using Python.
More, it is used to write code to review existing code, to automate particular functions, and it is also prominent with integrations in machine learning.