Important Topics in Python - Learn Python.
Updated: Feb 22, 2020
Python is a versatile, high-level, dynamic programming language. In this blog post, I’ve listed some important Python programming concepts. These concepts are not mostly covered by beginner-level tutorials. Also, some advanced Python topics are included. So, before learning these concepts you should have good knowledge in Python core concepts such as control flow, operators, functions, syntax, etc.
List Comprehension and Dictionary Comprehension
Comprehensions will help to reduce the lines of code and increase the execution speed of Python scripts.
Mutable and Immutable Objects
Everything in Python is an object, so objects are pretty important in Python. There are two kinds of objects in Python, such as mutable and immutable objects. Following code example will give you more idea about the mutability in objects.
Generators and Iterators
Generators and Iterators help to improve the memory efficiency of Python applications.
Lambda functions are anonymous functions. It is suitable for simple operations.
Map and Filter
The "map" function takes two arguments first one is a function and the second one is an iterator. The "map" function will take elements from the iterator one by one to do the operation then return the iterator.
The "filter" function behaves like the "map" function but the "filter" function works based on logical condition. It will eliminate items if the condition fails.
The 'with' statement help to reduce the error and improve readability. If you using 'with' statement to open files, it will handle exceptions and close the file object. We do not need to write the code explicitly to handle the exception and close the file object. Please find the example code below.
Cool isn't it!.
*args and **kwargs
'*args' and '**kwargs' are special kinds of arguments. '*args' takes the multiple arguments and wraps them in a tuple. '**kwargs' takes the list of named arguments and wraps them in a dictionary.
The decorator is an interesting concept in Python. The decorator function takes the function as an argument and returns another function. It is considered as one of the advanced Python topics.
Functions are first class objects in Python.
Planning is important for learning. In this article, I've listed the topics to learn in Python around 30 Days.
Thanks for reading!. Please comment below if any important topic missed.