Python 3, an Illustrated Tour Transcripts
Chapter: Language syntax
Lecture: More laziness
Login or
purchase this course
to watch this video and the rest of the course contents.
0:01
One of the general themes of Python 3 is laziness and so a lot of functions that returned lists in Python 2 are now lazy and behave as iterators,
0:12
either returning generators or views or something that is iterable. So map, filter and zip, and range are all examples of this.
0:21
In Python 2, these returned lists, that is no longer the case, they don't return lists anymore, they are iterables that you can loop over.
0:29
Similarly, a dictionary in Python 3 has keys, items and views, these same methods existed in Python 2
0:37
but in Python 2 these returned lists of what was in there. These are now views, views are slightly special
0:44
in that they reflect any updates that are made to the dictionaries. So if you're looping over it and it's been updated in the meantime,
0:51
you should get some values that update as well.