We have finally reached Christmas Eve, and the final language in this series, Python. This is a general-purpose, high-level language, designed to emphasize code readability. It supports object-oriented, imperative and functional, as well as procedural programming styles. It has a large standard library, and it provides a dynamic type system and automatic memory management.
Python is available for many platforms, and there are third-party tools to allow packaging in such a way that you can have it as a stand-alone executable, without needing to install an interpreter. The reference implementation, CPython, is open-source, and follows a community-based development process. This is the case with almost all of the alternative implementations.
The implementation of Python was started in 1989, by Guido van Rossum. Originally it was a successor to the ABC language, with added exception handling and interfacing the Amoeba operating system. In 2000 version 2.0 was released, and included a number of new features. This included a cycle-detecting garbage collector and support for Unicode. In 2008 version 3.0 was released, which is the latest release, and it is backwards-incompatible. However, many of its features have been ported back to version 2.6 and 2.7, which is backwards-compatible, and as such you see two version maintained today. This is due to the fact that a lot of applications is written in version 2.x.
Python is a general-purpose language, and can be used many places. To mention a few you, have web frameworks, such as Django, e-mail processing and data analysis and modelling. For more samples of where it is used, check out the sample list at python.org.
Example Hello World
For this example, I’ll be using Python 3.5.1, which you can find at python.org. When the installation starts, make sure you check the “Add Python 3.5 to PATH” at the bottom of the first screen. I went on from there by selecting “Install Now”. You might have to restart the machine, for the PATH variable to be updated. When the installation is done, verify that it was successful by running “python”, followed by “help()” in a command line, which should give you the help utility.
Now create a file called “HelloWorld.py”. Enter the following into it:
print ("Hello, World!")
Run it by running the following command in a command line:
This should give you “Hello, World!”.
Python is a language I am interested in learning, and it is the language I have planned to learn during next year. More on that later though.
So that´s it for 24 Days of Hello World. I have been through 24 more or less different languages. I will summarize this experience with a new post tomorrow, so be sure to check back for that as well!
Until then, merry Christmas!