Search code examples
pythonvisual-studio-codepylance

VSCode Python/Pylance does not gray out unaccessed variable


In below screenshot when hovering over the grayed out variables Pylance (correctly!) says they are not accessed, e.g.; "_baz" is not accessed Pylance. My question is about waz, which is clearly not accessed in either tabs, still not grayed out. Why isn't it grayed out?

enter image description here

I thought maybe it was related to waz not being a "private" (underscore) variable, but it just doesn't make sense...


Solution

  • Global variables without an underscore are considered public, so it might be used when imported from somewhere else.