Python3 Deep Dive II

Python3 Objects cannot be created without a class.

>>> a = 255
>>> b = 255
>>> a is b
True

>>> a = 256
>>> b = 256
>>> a is b
True

>>> a = 257
>>> b = 257
>>> a is b
False

Wait, what!?

Hint: Small Integer Caching.

Namespaces in C

https://github.com/sahil-time/ddads

The Web is the largest Client-Server Distributed System. HTTP is the most used protocol. It is language agnostic. HTTP response is a Web Page.

Browser is the Client side of the Web Application always. It can understand HTML, CSS, JS etc.

PIP installs globally. But if you want a container kinda environment to work with Python and local libs that can be different than global PIP libs, then use Python Virtual Env.

If you dont write anything in URL, by default it is /. / is a legal resource.

Python strings are delimited by ‘ ” ”’ “”” -> Single Quote, Double Quotes, Triple Single, Triple Double

Create Python file with JUST “wELCOME” save and run. The do the following

Apparently __doc__ stores the read only strings in Python module.

dir(obj) gives an exhaustive list of all methods that the Developer WANTS you to see. So its basically the Public API.

All callables return an Object in Python

Lists are Mutable and any type of data can be stored in same list. Tuple is immutable.

PIP installs globally. But if you want a container kinda environment to work with Python and local libs that can be different than global PIP libs, then use Python Virtual Env.

If you dont write anything in URL, by default it is /. / is a legal resource.

Python strings are delimited by ‘ ” ”’ “”” -> Single Quote, Double Quotes, Triple Single, Triple Double

Anything that ends in .py and has python code is a module.

Function in a class in a method. So any function associated with Class in a method.

Once you create an Object of Class, the Object is created on Heap and if the __init__ is defined, it gets called too. So the Object is constructed BEFORE calling the __init__.

By default ALL classes in Python are child of Object class [ which is standalone ]. No Class in without Inheritance in Python except Object class.

Multiple Inheritance where we have multiple methods with same name, Python resolves using C3-Linearization Algorithm that uses MRO which is similar to how linker resolves duplicate symbols [ if weak ] etc.

PYTHON INTERNALS

Test.py -> Python Interpreter -> Output

Python Interpreter can be written in any language, CPython is a standard Python Interpreter in C, there are a few others like PyPy [ In Python with help of C] , Jython [ In Java ], Skult [ written in JS ]

So in a way Python executable is an application written in C language 😀