Message402723
I'm glad that you fixed the bug in your code, but this is not a bug in
Python. It isn't "a parsing issue", the code is parsed fine. What you
did was no different from:
def func():
print(x)
x = 1
except that the binding operation was an import, not an assignment. You
get exactly the same error here:
def func():
print(math)
import math
That's the way the language is defined. Imports and assignments are both
binding operations and are treated the same by the interpreter. It's not
an accident or a mistake or a parsing issue or a bug, it is the way the
language is supposed to work. |
|
Date |
User |
Action |
Args |
2021-09-27 14:44:24 | steven.daprano | set | recipients:
+ steven.daprano, stars-of-stras |
2021-09-27 14:44:24 | steven.daprano | link | issue45294 messages |
2021-09-27 14:44:24 | steven.daprano | create | |
|