Python important things to know.

Object oriented programming:
------------------------------
>> In OOP class and objects are the main aspects.

>> Collection of data and its functionality is nothing but an OBJECT.

>> We can combine data and its functionality and we can wrap it inside something called as
      OBJECT.


What is Self:
---------------
>> "self" helps in differentiate b.w Instance Variable and Local Variable.

>> Instance variable is nothing but a variable which belongs to an object.

>> self refers to the object of the class itself.


. if x is not None and x.foo == 42:

>> This would not work correctly with the bitwise & operator because both sides would always be evaluated, giving AttributeError: 'NoneType' object has no attribute 'foo'.

>> When you use the boolean andoperator the second expression is not evaluated when the first is False.

>> Similarly or does not evaluate the second argument if the first is True.


Command to create virutal environment in windows:

 virtualenv.exe -p python djangoproject


Command to get into the Virtual Environment after creation of Virtual env:

$ source <project name>/Scripts/activate

How to create a virtual environment in windows for specific python version 
$ py -3.8 -m venv project_cariad 

How to check for different versions of python present in your windows machine 
$ py -0

 
 
 
 
 
 
 


Comments

Popular posts from this blog

Explain classes, __init__ and self in Python

Youtube technical links