Previous: 19-TestingFrameworks.html
Password for the Vimeo videos is in Zulip chat.
https://vimeo.com/536021820
Tip: If anyone want to speed up the lecture videos a little,
inspect the page, go to the browser console, and paste this in:
document.querySelector('video').playbackRate = 1.2
https://en.wikipedia.org/wiki/Syntactic_sugar
Code (to be stepped through in spyder
and/or
pudb
):
* 20-IteratorsGenerators/iter_00_comprehensions.py
* 20-IteratorsGenerators/iter_01_iterators.py
* 20-IteratorsGenerators/iter_02_generators.py
A sweet and elegant way to create lists, sets, and dictionaries
*
https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions
* https://realpython.com/list-comprehension-python/
*
https://www.digitalocean.com/community/tutorials/understanding-list-comprehensions-in-python-3
* https://www.geeksforgeeks.org/comprehensions-in-python/
*
https://www.geeksforgeeks.org/nested-list-comprehensions-in-python/
* https://www.learnpython.org/en/List_Comprehensions
* https://www.python-course.eu/python3_list_comprehension.php
An iterable object is an object that implements
_iter_
, which is expected to return an iterator
object.
An iterator is an object that implements next
, which
is expected to return the next element of the iterable object that
returned it, and raise a StopIteration
exception when no
more elements are available to be iterated through.
In the simplest case, the iterable will implement
next
itself and return self
in
_iter_
.
You can iterate across iterables using for loops, and/or you can use them to construct objects like lists directly using the constructor of the data structure.
“Never put off till tomorrow what may be done the day after tomorrow
just as well.”
~ Mark Twain
“I never put off till tomorrow what I can possibly do the day
after.”
~ Oscar Wilde
Next: 21-FunctionalProg.html