COMPSCI 61A Lecture Notes - Lecture 19: Mutation, Memoization

34 views6 pages
zogo39484755 and 6 others unlocked
COMPSCI 61A Full Course Notes
22
COMPSCI 61A Full Course Notes
Verified Note
22 documents

Document Summary

If x and y are two objects the equality test, x == y, does not automatically mean what you want it to mean. Tree(4) != tree(4) but after performing x = tree(4), x == x. The reason for this is that in python. All values are in fact pointers to objects, and. By default == on pointers compares the pointers themselves( are these pointing at exactly the same object) That is, by default == and != are the same as the is and is not operators. That can be changed on a class-by-class basis. For example, == on numbers, lists, tuples, strings, sets, dictionaries means what we expect: the contents are the same str tells us what the print function prints out. Repr tells us what to tell the interpreter. Defined as the largest one length to the farthest leaf. Removing subtres from a tree is called pruning. T. branches = [_____ for b in t. branches if t. label != 1]

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents