News for hackers. Stuff that matters.
Re:The CPython Bytecode Compiler Is Dumb by bakery2k on Monday February 25, 2019 @12:58AM (#19243356)
> any thread can change the internal variables of any other thread at any time

Why is this different from Java, where the JVM can assume that local variables cannot be changed by other threads?

That is, in the absence of special cases, which I believe include `volatile` and function calls. (Any other special cases?)

Re:The CPython Bytecode Compiler Is Dumb by mkl on Monday February 25, 2019 @04:18AM (#19244202)
Am I missing something, or does your first question answer itself? The question asserts a specific difference. (I don't remember how it works in Java to know if the assertion is correct.)
Re:The CPython Bytecode Compiler Is Dumb by bakery2k on Monday February 25, 2019 @04:33AM (#19244276)
As I understand it, the JVM can assume that local variables are not modified by other threads. My question is why can't CPython make the same assumption?
Re:The CPython Bytecode Compiler Is Dumb by anowlcalledjosh on Monday February 25, 2019 @06:32AM (#19244841)
Because it's not true! Threads in Python can muck around with the state of any other thread, at any time – it would be a language change to assume otherwise.
Re:The CPython Bytecode Compiler Is Dumb by maayank on Monday February 25, 2019 @09:56AM (#19246020)
What op means is that it’s not true in Java as well, but the JVM assumes it is true until detecting otherwise