Pylance possibly unbound in if statement
I have a code where some part depend on a global constant defined on top of the code (like which algorithm to use for doing my stuff). In the core of the function, if have a if statement in which some variables are defined, then later if do the same if statement to monitor values, as in this example MAGIC = True def func(): if MAGIC: a_magic = "magic" else: a_not_magic = "not magic" ... # some other stuff is done if MAGIC: print(a_magic) # "a_magic" is possibly unbound else: print(a_not_magic) # "a_not_magic" is possibly unbound But Pylance in VSCode catches two errors reportPossiblyUnboundVar
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.