What is Python?
Background
Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together.
Flavors of Python
There are various flavors of python though cpython is the oldest and original one.
- Cpython
- Jython
- IronPython
- Pypy
- Stackless Python
- Activestate ActivePython
- Portable python
- Anaconda python
- etc…
Please read here for more details.
Which flavor are we using here?
We will be using Cpython , that is downloadable from python.org
Websites using Python?
It is a well known fact that most web sites / applications are integrated applications and use multiple stacks depending on what layer (front, n-tier, backend etc.) we are talking about.
That said Django framework is in a growth mode and some of the websites that use are
For this course, we will now go ahead and get into hands on
As per codeeval website, python is the most popular language and the popularity is growing by leaps and bounds.
Install Python
We would eventually converge to using virtual environments with python – This means that we would have multiple versions of python on same system and have different versions of libraries/modules within each virtual environment. The purpose would be to have isolated environments for us to do development, without affecting each other. This is a best practice.
That said, since we are in basic tutorial stage, we will go ahead by assuming that we will have only one version on python on our system for all our needs. We will use windows/linux/mac to demonstrate, but bear in mind that linux/mac is more convenient and offers much better power and fun to code in python. That said, most of us have windows, so I will go ahead and demonstrate windows environment.
Step 1
Download python from website. We will use 3.x version
Step 2
After the installer downloads, run the installer by double clicking the .exe file
Step 4
Install for all users and then click Next
Step 5
Install to C drive , which the installer would pick up automatically (the primary drive)
Step 6
By default, the options are selected. Quickly glance through them and click next
Step 7
At this point, the installer should have all information to start the installation. Let it continue installing as follows
Step 8
The installer should install without errors and finally click Finish on the below screen
Step 9
Validate your install by opening a command prompt and typing “python -V” (observe the upper case V). It should return the version of python you installed on your machine as follows
Step 10
Download and install pycharm from here. You can either choose “community version” or professional version. Professional comes with a nice behave plugin that lets you execute behave scenarios from within the IDE. I would recommend buying professional, as it makes life simpler coding, with automatic style check etc. in the background taken care of. This post is not sufficient to talk about the benefits of pycharm professional
Closing Thoughts
Python installation is really very simple. Comparing it with other languages on this website i.e. Ruby and Java, the installation is straight-forward like Ruby and/or Java.
One observation is that with newer versions of python, we automatically have pip.exe and easy_install.exe included as part of runtime installation. Both of those are package managers to install python modules/libraries.