Closed RmZeta2718 closed 11 months ago
Unfortunately, linters won't be happy with injecting a random function into builtins
. Normally you can't do much magic if you want to make linters happy. So, you can explicitly from objprint import op
, or, if your code does not rely on print
, you can do a dark magic - op.install("print")
, which will replace the print
function in builtins
. linters will be happy as they know that's a built-in function, and all your print
s become an objprint print.
Thanks for your super fast reply! Sad to know that I can't inject op
into linters, but I love the dark magic.
install()
basically injectsop
intobuiltins
, but linters like mypy or pyright is not aware of that, so IDEs (vscode with pylance, for example) complains about that:"op" is is not defined Pylance(reportUndefinedVariable)
Besides manually ignoring type checking where op is used (
# type: ignore
), is it even possible to make mypy or pyright happy? Or should I raise an issue there?