-
Notifications
You must be signed in to change notification settings - Fork 0
Python Related
hyjing edited this page May 5, 2019
·
4 revisions
dict comprehension syntax (https://www.python.org/dev/peps/pep-0274/)
d = {key: value for (key, value) in iterable}
Remember that arguments are passed by assignment in Python. Since assignment just creates references to objects, there’s no alias between an argument name in the caller and callee, and so no call-by-reference per se. You can achieve the desired effect in a number of ways. (https://docs.python.org/3/faq/programming.html#how-do-i-write-a-function-with-output-parameters-call-by-reference) https://stackoverflow.com/questions/986006/how-do-i-pass-a-variable-by-reference
Can only modify node.next to change list (Ex. node.next = ListNode(0) works, but not node = ListNode(0))