Difference between `==` and `is` in Python, and when to use each of them

Posted on Sat 26 January 2019 in Python • Tagged with pythonLeave a comment

Difference

In Python there are many comparison operators; you always use them to check something in your code and let your code take decision according to the comparison

In this article, I want to go deep with two operators == to check equality, and is to check identity.

Continue reading

PACKT publishing ebooks and videos 50% discount offer

Posted on Wed 17 February 2016 in Python • Tagged with django, python, ebooksLeave a comment

Generously PACKT publishing is offering 50% discount on Python and Django ebook and videos. PACKT has many Python ebooks and videos from novice to advanced level, it one of the most publishing company that releases books and videos for Python and Django, If you tried to Google a book for Python or Django, you differently will find one of their books in the search results.

Interesting ebooks and videos for Python:

Python Machine Learning

Mastering Python

Python DAta Analysis

Geospatial Development by Example Python

Interesting ebooks and videos for Django:

Web Development Django Cookbook

Django By Example

Master Django Web Developement

Coupons

Please take the chance and buy your favorite Python or Django ebooks or videos form PACKT publishing. This offer is valid till 28th of March 2016 so please hurry up

  • For Python books and videos use PYTHON50 code.
  • For Django books and videos use DJANGO50 code.
Continue reading

Virtual Environment

Posted on Sun 01 March 2015 in Python • Tagged with django, pip, python, virtualenvLeave a comment

While leaning web developing using Django and Python, I found out VirtualEnv or Virtual Environment is widely used, in first I didn't get it because I came from Microsoft .NET Framework development platform, so I thought of writing a post about it to make simple.

What is Virtual Environment?

VirtualEnv or Virtual Environment is a way to create isolated development environment each one has it's own packages and specific package version, for example VirEnv1 has Django 1.6 and VirEnv2 has Django 1.7, this isolation will keep your project packages dependency clear, isolated, and as I'll show you below that you can replicate the environment with one command and file, so if you work in team it's easy to share the same environment among the team.

virtualenv 1 virtualenv 2

How to install VirtualEnv?

VirtualEnv is a python package so to install is you need to install pip first.

  1. Open terminal and type the following command

    sudo apt-get install python-pip

  2. After finish installing pip type the following command to install virtual environment

    sudo pip install virtualenv

  3. After finish installing virtualenv, type the following command to create folder to store your virtual environments

    mkdir .virtualenvs

How to create virtualenv?

After install virtualenv you are …

Continue reading