-
I'm using vscode and python for https://py.processing.org/. Thanks for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
While Python allows code to "insert" symbols into the namespace of another module, this practice is very fragile, and I would highly discourage library authors from using it. It potentially overwrites symbols of the same name in other modules, and it makes code difficult to follow (both for static code tools and for humans). Symbols should be imported explicitly to avoid namespace collisions. If you are the consumer of a library that implements this dangerous and ill-advised behavior, you have a few options:
from processing import frameRate, frameCount
from typing import TYPE_CHECKING
if TYPE_CHECKING:
def frameRate(a: int, b: str) -> int: ...
frameCount: int The first of these two options is preferable if it works. |
Beta Was this translation helpful? Give feedback.
While Python allows code to "insert" symbols into the namespace of another module, this practice is very fragile, and I would highly discourage library authors from using it. It potentially overwrites symbols of the same name in other modules, and it makes code difficult to follow (both for static code tools and for humans). Symbols should be imported explicitly to avoid namespace collisions.
If you are the consumer of a library that implements this dangerous and ill-advised behavior, you have a few options: