diff --git a/Day 3 reading notes.md b/Day 3 reading notes.md new file mode 100644 index 0000000..128a15d --- /dev/null +++ b/Day 3 reading notes.md @@ -0,0 +1,10 @@ +## 3.1 + +Note that the `type()` and `id()` builtin methods work both on themselves, and each other. + +Experiment: what is the class of the `type()` method? If you use `dir()` on the type class, there's an interesting method at the end of the list of the class contents, what does it do? + +The reason why the language reference is specific about saying that containers contain *references* to objects is that it's trying to tell programmers that Python does not *copy* objects to make data structures. This means that modifying objects inside containers will modify the one, original version of the object. Keep in mind that third-party libraries may not always make this guarantee, especially when it comes to big data, for performance reasons. + +Keep in mind that Python itself may sometimes change the identity of an object, such as when promoting an integer to a bignum because it got too large, but that doesn't affect the other guarantees expressed here. +