On 2022-10-09 15:18:19 -0400, Avi Gross wrote: > Antoon, it may also relate to an interpreter versus compiler issue. > > Something like a compiler for C does not do anything except write code in > an assembly language. It can choose to keep going after an error and start > looking some more from a less stable place. > > Interpreters for Python have to catch interrupts as they go and often run > code in small batches. Continuing to evaluate after an error could cause > weird effects.
I don't think this is really an issue. A python file is completely compiled to byte code before execution starts. It's true that a syntax error before an import prevents that import, but since imports are usually at the start of a file, a syntax error will only rarely prevent the import (and files intended to be imported generally don't have weird side effects anyway). One issue is could be that compilers which generate executables are generally thorough and slow, while the compilers which generate byte-code for immediate consumption by an interpreter are generally simple and fast. So there is more incentive for the former to discover as many errors as possible and they are also better equipped to do this. hp -- _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | h...@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!"
signature.asc
Description: PGP signature
-- https://mail.python.org/mailman/listinfo/python-list