Python Terminologies – Important terms you must know as a Python Developer

In this article, we will make you familiar with the important concept in Python that is, Python terminologies. In future, you will come across all these terms in various books and tutorials while learning Python.

So without wasting any time let’s begin with our tutorial on Python Terminologies!

Python Terminologies

1. >>>

When you open the Python shell, you will find this as the default Python prompt of the shell. This is where you write small snippets of code and press enter to run it.

2. 2to3

As Python 2 is soon going to be obsolete, coders are now switching from Python 2 to 3.

To make the transition easier, we have a tool that converts any code written in Python 2.x to Python 3.x. It is available in the standard library.

3. annotation

Annotations specify the expected type for a variable, a class attribute, or a function parameter or return value through a ‘type hint’.

4. argparse

It is a command-line parsing module in Python’s standard library that parses command-line options, arguments and subcommands.

5. argument

It is the value we pass to a function during the function call. There are two basic types of arguments:

  • Keyword Argument: an argument preceded by an identifier.

Example, 

power(base= 4, exponent= 2)
  • Positional Argument: an argument which has no identifier associated with it.

Example,

power(4,2)

6. assignment

The assignment is the process of assigning value to a variable. We depict the assignment operator by the equal sign (=).

The variable on the left side of the equal sign is assigned the value on the right side.

7. asynchronous context manager

An asynchronous context manager is an object that controls the environment by defining __aenter__() and __aexit__() methods. It allows you to allocate and release the resources as you need.

8. asynchronous generator

It is a function that returns an asynchronous generator iterator. It looks similar to our usual function except that we define it using ‘async def’ instead of ‘def’, and it contains ‘yield’ expressions.

9. Asynchronous generator iterator

An asynchronous generator function returns an object. This object is an asynchronous generator iterator.

We can this object using the __anext__() method. It returns an object which will execute the body of the asynchronous generator function till it encounters the next ‘yield’ expression.

10. asynchronous iterable

It is an object that returns an asynchronous iterator from its __aiter__() method.

11. asynchronous iterator

This is an object which implements the __aiter__() and __anext__() methods.

The __anext__() method returns an awaitable object. We can iterate over this object using the ‘async for’ statement.

12. attribute

An attribute is a value associated with an object. We reference it using the “dot operator”.

For example, if an object obj has an attribute attr we reference it as obj.attr.

13. assert

We use assert statements while debugging a test condition. If the condition is true, it does nothing.

But if the condition is false, it raises an AssertionError exception.

14. BDFL

The creator of Python, Guido Van Rossum, was titled the “Benevolent Dictator for Life”!

Told you Python was interesting in ways you couldn’t have imagined!!

15. block

It is a group of statements executing as a single unit.

16. binary file

A file object that stores information in the form of bytes, i.e., 0s and 1s. A binary file object is able to read and write bytes-like objects.

17. bytecode

Before translating the Python source code to machine code, we first compile it into a low-level intermediate code. This intermediate code is the bytecode.

A file with a .pyc extension contains this bytecode.

18. break

A break statement ‘breaks’ the usual control flow of execution. We use break to exit out of a loop.

19. class

This is a blueprint for creating user-defined objects of similar type. Class definitions group together data and method definitions operating on that data.

20. class variable

This is the variable whose definition is present inside a class and belongs only to that class. The scope of such a variable is confined at the class level and cannot be modified or accessed outside of it.

21. coercion

While performing an operation that involves two arguments of the same type, Python might have to implicitly convert an instance of one type to another. This process of converting a value of one type to another is known as coercion.

Example, to perform 2 / 3.0, the interpreter will have to convert int 2 into float 2.0, resulting in:

>>> 2/3.0
0.6666666666666666
>>>

22. compiler

A compiler translates a high-level language program to a low-level language.

23. context manager

An object that controls and manages the resources and the environment as seen in a ‘with’ statement.

24. context variable

Depending on different contexts, a variable can have different values. Such variables are known as context variables.

25. contiguous

A buffer is considered contiguous if all the items in the buffer are laid out next to each other in the memory. A buffer is contiguous exactly if it is either C-contiguous or Fortran contiguous.

26. coroutine

A more generalized form of subroutines is termed as a coroutine. Coroutines are implemented using the ‘async def’ statement.

27. continue

The continue statement alters the usual flow of execution of statements. It is used within a loop.

When the interpreter encounters a continue statement it skips the remaining statements in the current iteration and jumps to the next iteration if the condition of the loop evaluates to true.

28. conditional statement

Conditional statements determine which block of code should be executed depending on the boolean value of a conditional expression.

29. CPython

CPython is the standard implementation of the Python Programming language.

Coders and authors explicitly use this term while distinguishing this implementation of Python from others such as Jython or IronPython.

30. debugging

Debugging refers to the process of finding and removing bugs(errors) in a code.

31. decorator

We use decorators to add new functionality to an existing object or function without modifying its structure.

Examples include, classmethod() and staticmethod().

32. descriptor

Any object defining the methods __get__(), __set__(), or __delete__() is termed as a descriptor.

Descriptors form a basis for many features, like functions, methods, properties, class methods, static methods, making them significant in Python.

33. dictionary

It is an unordered collection of key-value pairs. It is a mapping of arbitrary keys to values.

34. dictionary views

The methods dict.keys(), dict.values(), and dict.items(), return some objects. These objects are known as dictionary views. These methods access the keys and values of the dictionary.

35. docstring

It is a string that contains a brief description of what a function, class or module does. It is often included as the first line of a function, class or module.

36. duck-typing

Duck typing is a programming style used by Python.

“If it looks like a duck and quacks like a duck, it must be a duck.”

Since Python is ‘dynamically-typed’, it uses duck typing to determine the type of an object.

Duck typing believes that while determining if the object is suitable for a given purpose, an object’s type is less important than the method it defines.

37. exception

An exception is an unwanted event that can disrupt the normal flow of execution of our program and may result in a halt or complete termination of our program.

38. expression

An expression is a piece of syntactical code that results in some value. It is made up of expression elements like literals, names, operators or function calls which all return some value.

39. extension module

It is a module written in another language like C or C++, using Python’s C Application Programming Interface.

40. f-string

The f-strings, stands for formatted string literals are those strings which are prefixed with ‘f’ or ‘F’. A formatted string contains normal strings together with “argument specifiers” or “place-holders”.

41. file object

File objects are used to perform operations on a file. These operations include accessing and manipulating files by reading and writing to it.

42. finder

When we import a module into our Python code, the interpreter is responsible for loading it into our program. A finder is an object which finds the loader for the imported module.

43. floor division

Floor division is a mathematical division operation that rounds down the quotient to the nearest integer. Floor division operator is denoted by //.

Example,

>> 3//2
1

44. function

A block of statements which performs some operation and returns some value to the caller. A function can be passed zero or more arguments.

45. function annotation

Function annotations indicate the type of function parameters and the expected type of value the function should return.

Example,

def add(a: int, b: int) -> int:
   return a + b

In this function, the two parameters should be integer type and the function should return a value of type integer as well.

46. garbage collection

Garbage collection refers to the process of freeing (collecting) memory which is not in use anymore so that it can be used later. The control of garbage collection lies within the gc module.

47. generator

A generator is a function that returns a generator iterator. It looks similar to the normal function definition except that it contains ‘yield’ expressions.

48. generator iterator

An object created and returned by a generator function. Each yield temporarily suspends the execution and the generator iterator picks up where it left off in the next execution state.

49. generator expression

An expression that is followed by a ‘for’ clause and returns an iterator.

Example,

>> sum(i for i in range(10))

This expression returns the sum of all the numbers from 0 to 9.

50. Generic function

It is the function which contains multiple implementations of the same operation for different data types. The implementation to be used during a call is determined at runtime using the dispatch algorithm.

51. High level language

A programming language which is easy for humans and difficult for machines to read and understand.

52. hashable

An object is hashable if the hash value generated for it (using a __hash__() method) never changes during its lifetime.

53. IDLE

IDLE is short for Integrated Development Environment for Python. It is the editor and interpreter used for building and executing Python programs.

54. immutable

An object whose value can’t be changed during execution is known as an immutable object.

Example, numbers, strings, tuples.

55. import path

It is a list of locations where the path based finder searches for modules to import. This list usually comes from sys.path.

56. importing

Importing means loading the code of one module to another module so that it can be reused.

57. Importer

An object which is responsible for finding and loading a module that is being imported.

58. Indentation

Python uses whitespaces to mark the beginning and end of a code block.

59. Interactive mode

Python’s interpreter is interactive in the sense that you can run small snippets of code in the Python shell. The interpreter will immediately run them for you and show the result for it.

60. interpreted

Python uses an interpreter for converting its source code into machine code and executing it. That’s why Python is known as an interpreted language.

61. Interpreter shutdown

You can ask the interpreter to shut down upon which the interpreter will enter a phase where it will release all the allocated resources. It will also make calls to the garbage collector.

62. iterable

An object which can be iterated over or which can return its members one at a time is known as an iterable.

Examples include lists, sets, tuples, dictionaries, strings etc.

63. iterator

This is an object that represents a stream of data. The successive items in this stream can be returned using repeated calls to __next__() method.

Summary

Here we come to the end of our article on Python Terminologies. In this article, we explored few numbers of terminologies in Python.

This was just the first part of all the important terminologies we have in Python.