News for hackers. Stuff that matters.
Re:The PEPs of Python 3.9 by pansa2 on Thursday May 28, 2020 @07:56PM (#23344605)
When the Python source code is compiled into bytecode.
Re:The PEPs of Python 3.9 by nomel on Tuesday June 02, 2020 @12:50AM (#23387577)
That byte code is then interpreted at runtime, so the meaning of s.upper() could change. What something does, when it’s parsed, is not fixed.

You can definitely catch most cases at runtime. I’ve done something like this, in an library, to catch a case where people were treating the copy of data as a mutable view.

    interface[address][slice] = new_values # fancy noop
Where a read, modify, write was required:

    byte_values = interface[address]
    byte_values[slice] = new_values
    interface[address] = byte_values
It would log/raise a useful error if the there was no assignment/passing of the return value.