Update page 'Day 3 reading notes'

j
2023-03-31 22:29:18 +02:00
parent b9321f4948
commit 3ff032e155
+11 -1
@@ -12,4 +12,14 @@ Keep in mind that Python itself may sometimes change the identity of an object,
The phrase "access to the implementation" is a warning sign saying "don't do this." Python, the language, is an abstract concept which makes certain guarantees that if you type Python code and run it, certain things will happen. There are many different implementations of Python (see chapter 1). Poking around in how the implementation works breaks the guarantee that Python code will run the same on CPython, Jython, etc, and is generally only done for performance or troubleshooting reasons.
Exercise: see how it says "It should not be evaluated in a boolean context."? Do it anyway.
In most cases, Python analysis work doesn't involve data literals as input, that usually comes from a database or API. It does use data literals as output, which is why focusing so much on formatting issues is important: output must be clear and unambiguous.
This section is about the *abstract concept* of that data, which is how it exists in computer memory as bytes.
Thought experiment: if you have a sequence where you set only entries 1 and 100 to a value, what do you think should happen if someone accesses entry 50?
Note that `ord` and `chr` are inverses of each other.
Attributes have a more precise definition, but for now just understand that an *attribute* is a property of a Python object which contains either data or code. Attributes are key to making your software easily usable by others, and for you to inspect other code modules that you may be troubleshooting or working with.
Don't worry about fully understanding the details of the class definitions, but you should take apart the paragraph that starts with "When a class attribute reference..." with a fine-tooth comb so you understand exactly what each of the terms mean, especially the difference between a class method object and a static method object.