Posts Tagged with 'Python'

The answer here is no. The modules with circular references to other objects, or to objects referenced from global namespaces, aren’t always freed on exiting Python. Plus, it is impossible to de-allocate portions of memory …

Last updated 3 weeks, 4 days ago | 24 views

Tags:- Python

Python | Dogpile effect In case the cache expires, what happens when a client hits a website with multiple requests is what we call the dogpile effect. To avoid this, we can use a semaphore lock. When …

Last updated 3 weeks, 4 days ago | 20 views

Tags:- Python

Python | Iterator | (__iter__ and __next__) Iterators are objects that can be iterated upon. The iterator protocol for Python declares that we must make use of two functions to build an iterator- iter() and next().   …

Last updated 3 weeks, 4 days ago | 19 views

Tags:- Python

Python | Exception Handling Python has many built-in exceptions that are raised when your program encounters an error. Try and Except Statement – Catching Exceptions: Try and except statements are used to catch and handle …

Last updated 3 weeks, 4 days ago | 25 views

Tags:- Python

Primitive data types are Integers, Float, Strings, and Boolean. Non-primitive data types are Array, List, Tuples, Dictionary, Sets, and Files.    

Last updated 3 weeks, 4 days ago | 22 views

Tags:- Python

Using PDB we debug code in python. Some pdb commands include- <b> — Add breakpoint <c> — Resume execution <s> — Debug step by step <n> — Move to next line <l> — List source code …

Last updated 3 weeks, 4 days ago | 22 views

Tags:- Python

Python | new_style and old_style Old-style: With old-style classes, class and type are not quite the same things.  If obj is an instance of an old-style class, obj __class__ designates the class, but the type(obj) is always …

Last updated 3 weeks, 4 days ago | 23 views

Tags:- Python

Python | Global, Local and Nonlocal variables Global variables are public variables that are defined in the global scope.  A variable declared inside the function's body or in the local scope is known as a …

Last updated 3 weeks, 5 days ago | 28 views

Tags:- Python

The two static analysis tools used to find bugs in Python are Pychecker and Pylint. Pychecker detects bugs from the source code and warns about its style and complexity. While Pylint checks whether the module …

Last updated 3 weeks, 5 days ago | 21 views

Tags:- Python

Python |  / and // Operator /: is a division operator and returns the Quotient value. e.g: 10/3  will return 3.33 // : is known as floor division operator and used to return only the value of …

Last updated 3 weeks, 5 days ago | 19 views

Tags:- Python

Python has a multi-threading package, but commonly not considered good practice to use it as it will result in increased code execution time. Python has a constructor called the Global Interpreter Lock (GIL). The GIL ensures …

Last updated 3 weeks, 5 days ago | 21 views

Tags:- Python

Python | append() and extend() Function Both append() and extend() methods are methods used to add elements at the end of a list. append(element): Adds the given element at the end of the list that is …

Last updated 3 weeks, 5 days ago | 23 views

Tags:- Python

Python | map() Function The map() function executes a specified function for each item in an iterable. The map() function in Python has two parameters, function and iterable. The map() function takes a function as an argument and …

Last updated 3 weeks, 5 days ago | 22 views

Tags:- Python

Python | Send an email To send an email, Python provides smtplib and email modules. Import these modules into the created mail script and send mail by authenticating a user. It has a method SMTP(smtp-server, port). …

Last updated 3 weeks, 5 days ago | 21 views

Tags:- Python

Python | enumerate() Function The enumerate() function is used to iterate through the sequence and retrieve the index position and its corresponding value at the same time.   lst = ["A","B","C"] print (list(enumerate(lst))) #[(0, 'A'), (1, 'B'), …

Last updated 3 weeks, 5 days ago | 19 views

Tags:- Python