COMPSCI 61A Lecture Notes - Lecture 30: Init, Declarative Programming, Iterator
zogo39484755 and 6 others unlocked
22
COMPSCI 61A Full Course Notes
Verified Note
22 documents
Document Summary
Many data sets can be processed sequentially. Sensor readings of an airplane through time. However, sequence interface we used before does not always apply. Sequence allows elements selection for any element. Data is constantly changing so, data is gone. Now think about how to get computer to handle large amounts of input. Implicit representations of streams of sequential data. Not have entire data set available, but be able to access elements but doesn"t store it all. Declarative programming languages to manipulate and transform data. Used in python as way to access elems of different containers. Iter(iterable): return an iterator over the elems of an iterable value. Next(iterator): returns next element in an iterator. Iterators are always ordered, even if the container that produced them is not. Different iterators would give the same, for dict that hasn"t been modified. Eval header which must evaluate to an iterable object. A stopiteration exception is raised whenever next is called on empty iterator.