Return to site

Fluent Python

Glossary

Iteration - An iterator is an object that allows you to iterate over collections of data, such as lists, tuples, dictionaries, and sets.

Collections - This module implements specialized container datatypes providing alternatives to Python’s general purpose built-in containers, dict, list, set, and tuple.

Attribute access - Attributes are variables of a class that are shared between all of its instances.

Operator overloading - Operator Overloading means giving extended meaning beyond their predefined operational meaning. For example operator + is used to add two integers as well as join two strings and merge two lists. It is achievable because ‘+’ operator is overloaded by int class and str class.

Function and method invocation - A block of statements that return the specific task

Object creation and destruction - An object is a fundamental concept that represents a particular instance of a class.

String representation and formatting - A type of data

Dunder methods - Shortcut for saying underunder getitem underunder (__getitem__)

Encapsulation - It describes the idea of wrapping data and the methods that work on data within one unit. This puts restrictions on accessing variables and methods directly and can prevent the accidental modification of data.A class is an example of encapsulation as it encapsulates all the data that is member functions, variables, etc. Variable represented with starting with "_a"

Private member - Private members are similar to protected members, the difference is that the class members declared private should neither be accessed outside the class nor by any base class. Variable represented with starting with "__a"

Complexities of Python Operations

- The first has a time complexity of O(N) for Python2, O(1) for Python3 and the latter has O(1) which can create a lot of differences in nested statements.  

- Lists are similar to arrays with bidirectional adding and deleting capability.

- Dictionaries and Set use Hash Tables for insertion/deletion and lookup operations.

broken image

 

broken image