Terminologies in Python – Don’t call yourself a Python Developer if you don’t know these terms
The Terminologies in Python article by TechVidvan will guide you towards some amazing terminologies in python.
So, let’s go ahead and learn about them.
Keeping you updated with latest technology trends, Join TechVidvan on Telegram
Terminologies in Python
‘lambda’ is a keyword that lets you create lambda functions.
These are anonymous functions used to perform simple computations.
>>> x = lambda a, b: a + b >>> x(5, 6)
Now, x is a function that takes two arguments and returns their sum.
A list in Python is an ordered, mutable collection of objects.
These objects can be of different types.
Below is an example of a valid list in Python:
list1 = [‘Techvidvan’, 2, 9.0]
3. List comprehension
List comprehensions provide a way to create lists in a concise manner.
We do this by writing an expression inside square brackets and assigning it to a variable.
list1 = [i for i in range(10)]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Literals are data items that have a fixed value.
Python allows several kinds of literals like string, numeric, boolean etc.
5. List length
List length refers to the size of a list, that is, the number of elements in the list.
A loader is an object that loads a module that is being imported.
A loop is used for iterating over a sequence (like list, tuple, string, dictionary, set).
Python offers two loops: for and while.
Python Methods are functions associated with an object.
Methods of an object operate on the data of that object.
We call a method on an object using the dot operator.
For example, if obj is an object and med() is its method, we call it as obj.med().
A module is a file consisting of Python code.
This module can be imported and the code within can be reused in another Python program.
MRO stands for Method Resolution Order.
It defines the order in which Python Interpreter looks for a method in a hierarchy of classes.
A mutable data type is one that can change its value during the program execution.
12. Nested loop
Nested loops refer to a loop within another loop.
For each pass of the outer loop, the inner loop executes completely before moving on to the next pass of the outer loop.
An object is a collection of data and methods.
Objects model real-world entities in object-oriented programming.
Object-oriented programming is a programming paradigm that is based on objects.
The emphasis in object-oriented programming is on data rather than procedure.
A parameter is a variable that is specified in a function definition inside the parenthesis.
Parameter denotes the argument values a function can accept.
pass keyword is used to write a pass statement.
Pass statement is used when there is a syntactical need of a statement but your program’s logic doesn’t need one.
17. PEP 8
PEP 8, that is, Python Enhancement Proposal is a style guide of Python code.
It includes guidelines and rules that define how to write better looking Python code.
A piece of code is said to be Pythonic if it is not only syntactically correct but also follows the guidelines and conventions of the Python community.
A set is an unordered collection of data that allows only unique values.
All operations that can be performed on a mathematical set can be performed on a Python set as well.
It refers to accessing a particular part of a sequence, like lists, tuples, and strings.
Slicing can be used to modify and manipulate parts of mutable sequences like lists.
A slice of a list is accessed as follows:
<listname>[start : stop]
In the below example we modify the list slice starting at index 3 and ending at index 4.
We can see the change in the original list.
A string is a sequence of characters.
A string in Python is immutable and is written within single or double-quotes.
Python does not support a character data type, so a character in Python is just a string of length 1.
>>> string1 = “Techvidvan”
A statement in Python specifies an instruction given to the machine to perform a particular task.
A statement forms the smallest executable unit within a Python program.
Python allows catching exceptions that may occur in the code written within a try block.
The exceptions caught can be handled by an except clause written right below the try block.
A tuple is an ordered, immutable collection of data.
A tuple, once defined, cannot change the value of its elements during the program execution.
The type of object defines the kind of object it is.
The type of an object can be found out using the type() method.
A variable in Python is a named memory location that stores a value.
The variable is capable of changing its value during the program execution.
27. Virtual machine
The Python Virtual machine is responsible for executing the bytecode generated from the Python source code.
A yield expression returns a value from a generator function in Python
29. Zen of Python
The ‘import this’ command prints out the philosophy in which Python believes.
Go to the Python shell and type this:
Here we come to the end of our tutorial.
In this article we explored some of the terminologies in python.
Now that you know all the important Python Terminologies, we are sure that through this article you will get a better understanding of Python, its syntax and its working.