ics 33 final

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/7

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

8 Terms

1
New cards

static method

  • called on CLASS as whole, NOT on object of class

  • has nothing to do w object specific data, only on the class

  • doesnt need self param

2
New cards

class method

  • applies on CLASS as a whole, not objects

  • takes cls as a param bc needs class for smth

  • useful for creating factory methods (create objs of a type

3
New cards

class attributes

  • variables that belong to the class itself, not to any instance.

  • shared among all instances of the class, often used for constants or default values.

4
New cards

__dict__

  • a special attribute of a class or instance that holds a dictionary containing all its writable attributes. Provides a way to dynamically access or modify the attributes of an object.

5
New cards

iterable

  • smth that can be ITERATED over

  • it knows HOW TO GIVE U AN ITERATOR

  • can use a for loop or iter() over them

  • ex: lists, strings, ranges, tuples, etc

  • like a book (smth u can flip the pgs thru)

6
New cards

__iter__(self)

  • what MAKES the OBJECT iterable

  • by returning ITERATOR for that object

  • how to use: iterator = iter(object)

  • like the process of getting a new bookmark for the book

7
New cards

iterator

  • the obj that produces a sequence of values, 1 at a time

  • manages the itertion process

  • keeps track of where u are rn, how to give u the next element

8
New cards

generator

  • function that produces sequence of results 1 at a time, instead of all at once (lazy evaluation - only does work when its asked)

  • uses yield instead of return

  • yields a value, then pauses. always rememebers its exact state

  • O(1) MEMORY ONLY!

  • generators are also iterators