Intermediate Python _ Programming Study Guide.pdf
Intermediate Python _ Programming Study Guide.pdf
Intermediate Python | Programming
Study Guide
Guidehttps://www.stuvia.com/dashboard!@_)#*)(@$)($@*($@)($@*_
Intermediate Python _ Programming Study Guide.pdf
Intermediate Python _ Programming Study Guide.pdf
Intermediate Python _ Programming Study Guide.pdf
,Intermediate Python.pdf Intermediate Python.pdf Intermediate Python.pdf
Terms in this set (168)
What is a Python gotcha? - a counterintuitive feature of a programming language that often
leads to mistakes in programs
What is a mutable object in Python? Is the - refers to various containers in Python that are intended to allow
memory id the same or different on edits? change
- memory id will remain the same
What are some examples of mutable objects? - lists, sets, and dictionaries are all mutable
Intermediate Python.pdf Intermediate Python.pdf Intermediate Python.pdf
,Intermediate Python.pdf Intermediate Python.pdf Intermediate Python.pdf
What is an immutable object in Python? Is the - objects that cannot be modified
memory id the same or different on edits? - memory id will be different
What are some examples of immutable objects? - int, float (arithmetic operations will return a new number)
- string (operations that update a string result in a completly new
string)
- - tuple (immutable list)
How can we obtain the memory id of an object? - pass the object to the id() function
Intermediate Python.pdf Intermediate Python.pdf Intermediate Python.pdf
, Intermediate Python.pdf Intermediate Python.pdf Intermediate Python.pdf
Why can't we use mutable objects as default - when we use a mutable object as a default argument, that argument
arguments inside functions? is only created once alongside the function
- repeated function calls without an argument modify the same object
from previous calls — not a new, empty one.
How can we work around the restriction around - we can use the None workaround
mutable default arguments inside functions if we - we can then check to observe whether or not an argument value was
want an empty mutable argument? provided, and if there wasn't we can then instantiate a new value
Intermediate Python.pdf Intermediate Python.pdf Intermediate Python.pdf