Duplicate import inside global and function scopes #59
Replies: 2 comments
-
|
Most of the time when an import used inside a function: it is either used for its side effect when you call the function, or it is so that it doesn't shadow any other outside variable(which is not really a good reason if you ask me) as far as I've stumbled upon imports like these. I honestly wouldn't ever use such a feature since it may potentially break projects inherited -I say inherited as I'd never use imports inside a function- but I'm all in favor of configurable features with smart defaults. |
Beta Was this translation helpful? Give feedback.
-
|
Scope analysis has been added so it works and as expected this discussion can be closed. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
For example, unused import wrong will be detected in the example below.
After using unimport
But, It should be expected codes
Discussion
Should we solve this problem? I think this is a very rare case, and I think developer who knows python well does not apply for such use.
Beta Was this translation helpful? Give feedback.
All reactions