7 ms·
Have you seen the Python docs which have pages on the execution model and data model, with notes in implementation details? https://docs.python.org/3/reference
by marmaduke 5y ago
Have you seen the Python docs which have pages on the execution model and data model, with notes in implementation details?
https://docs.python.org/3/reference/executionmodel.html https://docs.python.org/3/reference/executionmodel.html
https://docs.python.org/3/reference/datamodel.html https://docs.python.org/3/reference/datamodel.html
- haberman 5y agoIn your second link it says: > For instance, to evaluate the expression x + y, where x is an instance of a class that has an __add__() method, x.__add__(y) is called. The talk I linked to (https://youtu.be/qCGofLIzX6g https://youtu.be/qCGofLIzX6g) is a deep dive on how there is much more to the story than the simplified statement above. What I wish for is not better docs, but rather simpler language in which the statement above would actually be an accurate specification of the behavior implemented by the interpreter.
- ggrrhh_ta 5y agoI guess you are trying to imply that those documents cover a formal-enough description of what the execution and data model is. Well, even for the section "names" it just forgets to say if imported and non-imported names all share the same encoding and which should it be - just a nitpick, but with less than 5 seconds. Do you know that there are some behavioral limitations of dict that arise from a specific optimization in the implementation in C of dictionary iterators? If you create a new python following those documents, it is possible that you will allow a perfectly reasonable behavior that would fail in most other python interpreters.
- joshuamorton 5y ago> Well, even for the section "names" it just forgets to say if imported and non-imported names all share the same encoding and which should it be - just a nitpick, but with less than 5 seconds https://www.python.org/dev/peps/pep-0263/ https://www.python.org/dev/peps/pep-0263/ Names aren't unique. > Do you know that there are some behavioral limitations of dict that arise from a specific optimization in the implementation in C of dictionary iterators? I'm rather curious what you're referring to here, do you mean dict-ordering, or something else?
- ggrrhh_ta 5y agoSorry, but "names aren't unique" does not even begin to define uniqueness - "from ... import X" imports and X; great; should it replace an "X" in a different encoding in the local namespace, or not? I can tell you it has to do with iterators, and maybe someone will comment on what that is.
- joshuamorton 5y agoBy names aren't unique, I mean with respect to "encoding", everything is the same. It seems like you're using "encoding" to mean something it doesn't? Do you just mean like "value"? > I can tell you it has to do with iterators, and maybe someone will comment on what that is. This sounds like you don't know what it is.
- deleted 5y ago[deleted]
- webmaven 5y ago> By names aren't unique, I mean with respect to "encoding", everything is the same. It seems like you're using "encoding" to mean something it doesn't? Do you just mean like "value"? I think the GP means character encodings. So the intent here is to ask whether (for example) a foo defined in a ISO 8859-1 encoded file is overidden by a foo imported from a Windows-1256 encoded file.
- joshuamorton 5y ago> I think the GP means character encodings. Then the link I posted answers their question. Names aren't unique in how encodings are handled. Files are decoded and canonicalized as a unicode string. If the identifiers are the same after canonicalization, then yes they are equivalent. If they aren't, then they aren't.
- webmaven 5y agoAh, I misunderstood what you meant by "aren't unique". I would have phrased that as "names aren't treated differently", or something similar.