In this video, learn how to write basic comprehensions for lists, dicts, and sets; as well as more advanced comprehensions, with if clauses and multiple loops.
- [Narrators] We move on from loops and iterators to two…powerful related concepts, comprehensions and generators.…Comprehensions are a way to run a loop within a single line…of code, and to collect the results of the loop…in a collection, such as a list.…Generators are a shortcut to write…functions that implement iterators.…Both are used extensively in Pythonic code.…In this video, we will learn how to write…list, dict, and set comprehensions,…how to use Python generator expressions,…and how to write Python generators.…
I'll begin by importing all the packages…used in this chapter.…I will also run a few lines of code that recover…the data structures that we built in the last video.…I read those from adjacent file that I open…and then load with adjacent package.…The Python designers realize that there are many situations…where you write a full loop to select the subset…of a sequence, operate on each selected element…individually, and collect the resulting modified elements…in a list, or in another collection.…
- Designing efficient loops
- Exploiting Python collections
- Writing Pythonic code
- Choosing the best libraries for your tasks
- Downloading webpages with requests
- Parsing HTML with Beautiful Soup
- Manipulating images with Pillow
- Making videos and drawing on maps with matplotlib
- Serving webpages with Jinja2 and Flask
- Working with Python classes
- Taking advantage of functional techniques
- Profiling CPU and memory use
- Exploiting parallelism
Skill Level Intermediate
1. Installation and Setup
Jupyter notebooks3m 19s
2. Writing Python Efficiently
3. Exploiting Python Libraries
4. Advanced: Python Object-Oriented and Functional Programming
5. Introduction to Performance Optimization in Python
Next steps1m 2s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.