Home
Alexander Lu
Cancel

CS61A: Inheritance

Inheritance A method for relating classes together. A common use case is two similar classes that differ in their degree of specialization The specialized class has same attributes as a gene...

CS61A: Lecture 21

Lecture Composition A linked list is a recursive data structure that represents a sequence. List Efficiency - Fast Appending, assigning, and list comprehensions are fast The...

CS61A: Attributes

Attributes Method Calls Method calls differ from function calls because they are invoked with dot notation. <expression>.<name> The <expression> can be any va...

CS61A: Objects

Object-Oriented Programming OOP provides a method for organizing large programs large programs can be organized into small, modular components that can be developed at ones. Ext...

CS61A: Lecture 17

Objects Review - Mutability What would be the final values of the names defined within this code segment? def func1(lst1): lst1 = lst1[0:-1] return lambda lst: lst + lst1 def func2(ls...

CS61A: Lecture 16

Generators An iterable is any sequence we can iterate over (we may clal iter() on the iterator and get an iterator) An iterator allows us to iterate over any iterable sequence (we can call nex...

CS61A: Generators

Generators A special form of an iterator that is returned from a generator function. The generator object iterates over all yielded values of a function. In the generator funtion, we ...

CS61A: Lecture 15

Iterators List Practice silver = [1, [3]] gold = [2, [4,5]] plat = chain([6, [7,8]]) = [6, [7,8]] [1,2,3] [1, [2,3]]

CS61A: Iterators

Iterators Most forms of sequential data are implicity represented with an iterator. Iterators are a programming interface that are used in python to access the elements of various containers. ...

CS61A: Mutability

Objects Objects are values that behave like what it’s supposed to represent Ex: datetime module from datetime import date date datetime.date In datetime, date is a class that literall...