Posts Tagged with 'Python'

No. However, Abstract Base Classes (ABCs) are a feature from the abc module that let us declare what methods subclasses should implement. Python supports this module since version 2.7.

Last updated 2 years, 5 months ago | 914 views

Tags:- Python

MRO stands for Method Resolution Order. Talking of multiple inheritances, whenever we search for an attribute in a class, Python first searches in the current class. If found, its search is satiated. If not, it …

Last updated 2 years, 5 months ago | 890 views

Tags:- Python

Python | filter(), map(), and reduce() Functions filter()  function accepts two arguments, a function and an iterable, where each element of the iterable is filtered through the function to test if the item is accepted or …

Last updated 2 years, 5 months ago | 886 views

Tags:- 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 2 years, 5 months ago | 898 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 2 years, 5 months ago | 906 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 2 years, 5 months ago | 991 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 2 years, 5 months ago | 1036 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 2 years, 5 months ago | 928 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 2 years, 5 months ago | 926 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 2 years, 5 months ago | 893 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 2 years, 5 months ago | 867 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 2 years, 5 months ago | 933 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 2 years, 5 months ago | 879 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 2 years, 5 months ago | 910 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): append() method adds the given element at the end of the list. …

Last updated 2 years, 5 months ago | 903 views

Tags:- Python