This video tackles and discusses the list comprehensions and how it is useful in Python. Understanding how comprehensions work, even when you do not like working with them, will give you a better understanding of Python codes you encounter. By the end of the session, you will gain knowledge on when to use and when not to use them.
Here comes another great video from the recently concluded PyCon 2020, the largest annual gathering for the community of Python programming language users and developers. In this video presented by Trey Hunner of Python Morsels, we will particularly learn about a certain Python feature that he described as an “often misunderstood feature” by most new Python developers ~ the List Comprehension.
List comprehensions in Python are generally used for creating new lists from other iterables. Trey described List Comprehensions as a special syntax for looping over any iterable and building up a new list from it, modifying and/or filtering elements along the way. This 32-minute-long video presentation will highlight everything we need to know about list comprehension, why do they exist, and why developers use them. The video will also demonstrate how to use list, set, dictionary comprehensions, and as well as generator expressions.
Many people used to dislike this particular feature because they are relatively hard to read. Interestingly, in this presentation, we will not just learn why list comprehensions are often hard to read but we will also discover interesting ways to make your comprehensions more readable. The video will also introduce us to the purpose of generator expressions and when to use them instead of List comprehensions.
To learn more about this interesting feature in Python Programming language, feel free to watch the comprehensive presentation below and see how you will be able to understand and appreciate list comprehensions. Enjoy