This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In Python access specifiers doesn't exist.Beacause it's considered as we all are adults here I mean if developerdoesn't want to aceess | |
a variable why will he. | |
In case if some variable needs to private it is initiated with '__'. | |
The main concept behind not having any of those logic is because, We used to have those access specifiers so | |
that out side classes will not be able to use the attribute of a class. But unless the developer will not try to | |
access a class within another class, They are not going to be used like that. | |
So default is public anyone can access any method anywhere. | |
But, You can privatize them in a different and more logical way. Using _ or __ . | |
__ can be used to define private attributes in a class. by default we define all variable names as words, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What is Exception? | |
An exception is an error that happens during execution of a program. When that | |
error occurs, Python generate an exception that can be handled, which avoids your | |
program to crash. | |
Why use Exception? | |
Exceptions are convenient in many ways for handling errors and special conditions | |
in a program. When you think that you have a code which can produce an error then | |
you can use exception handling | |
Raising an exception breaks current code execution and returns the exception | |
back until it is handled. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://res.cloudinary.com/dyd911kmh/image/upload/c_scale,f_auto,q_auto:best,w_700/v1512740202/Template_2_oxrskq.png | |
Data structures(list,tuple,strings,dictionary,sets) | |
=========================================================== | |
Diff between tuple and sets | |
tuple:Immutable type,can contain dubplicates also defined in() whereas indexed | |
Sets:Mutable type,cannot contain dubplicates and defined in {} | |
empty set has to define like |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://www.comlab.hut.fi/opetus/238/lecture7_RadioInterfaceProtcols.pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Since Python dictionary stores key value pairs, it uses hashing operations to store the values. | |
It is not necessary for the hash values to be in sorted order. | |
So when you print the dictionary the values are displayed on the basis of hash values and so python’s dictionary is un ordered. | |
If you want python dictionaries in sorted order, you can use sorted() function. | |
If want to use ordered dict in python we can use "ordereddict" module in short. | |
from _ordereddict import ordereddict | |
kio = ordereddict() | |
kvio = ordereddict(kvio=True) | |
# without relax unordered initalisation is not allowed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://www.techtrained.com/paging-procedure-lte/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://www.youtube.com/watch?v=4ht22ReBjno | |
https://www.youtube.com/watch?v=TvnZTi_gaNc | |
https://www.youtube.com/watch?v=lcQfQRDAMpQ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JSON - Python has a JSON module that will help converting the datastructures to JSON strings. | |
Use the import function to import the JSON module. | |
import json | |
student = {"101":{"class":'V', "Name":'Rohit', "Roll_no":7}, | |
"102":{"class":'V', "Name":'David', "Roll_no":8}, | |
"103":{"class":'V', "Name":'Samiya', "Roll_no":12}} | |
print(json.dumps(student)); | |
Output: | |
{"103": {"class": "V", "Name": "Samiya", "Roll_no": 12}, | |
"102": {"class": "V", "Name": "David", "Roll_no": 8}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you are using python 2, then you can add a comma after the print function like this: | |
for i in range(10): | |
print i, # <- notice the comma at the end | |
will output: | |
0 1 2 3 4 5 6 7 8 9 | |
In python 3, print is now a function and will take an argument, called end like this: | |
print(i, end = " ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Multiprocessing Vs Multithreading : | |
Multiprocessing is when the part of program can be executed by separated processes. | |
The cost of multiprocessing is really high. | |
MultiThreading: | |
The main program is divided into sub threads. | |
Here to decide the number of thread is a big challenge , taking more number of threads can deduce ur latency since | |
thread concurrency has limit , after a limit it slows down the process. |