-
Notifications
You must be signed in to change notification settings - Fork 7
Description
- Namespaces are new (I know they're marked as "revisited" in the notes, but they never appear before – alternatively, we can add them to Python basics?
-
Builtins: you shouldn't be naming variables that overwrite Python's builtins (abs, len, list - a full list is available here) in the first place, but in the event that you are, Python will check here anyways. 🙃
Either this is incorrect or I'm getting confused by it. Consider, for example:
sum = 3 sum(1, 2, 3) # TypeError: 'int' object is not callable
In this code, Python will use
3in place of the builtinsumwhensumis referenced. That means Python a) doesn't "check here [the builtins] anyways" because it stops once it findssumin the global table, b) it's a little misleading to say that we're "overwriting" the builtin even though we talk that way – you can still access it with__builtins__.sum. -
When calling a function, Python enforces that positional arguments must appear in the function call before keyword arguments.
Might want to mention why?
- This is kinda painful, but it's not precise to describe the first/second line(s) of execution like you do.
- You never mentioned that "if this is confusing, you can treat mutable objects like pass-by-reference and immutable objects like pass-by-value."
- Can we rename `euclidean_dist`? I think some students might not know what that means.
I didn't look over everything, but these are my initial thoughts!