Update page 'Day 3 reading notes'

j
2023-03-31 20:45:39 +02:00
parent b8a2cad2e6
commit 61f749ec6b
+10
@@ -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.