This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pablogsal
Recipients Mark.Shannon, oleksandr.suvorov, pablogsal
Date 2020-05-22.11:19:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> as it's either the
variable should exist and have a value or it should be unknown and result
in NameError at this point.

One thing is the symbol and another thing is its value. The function is always aware of the existence of the symbol. For instance:

def f(x):
   del x

>>> print(f.__code__.co_varnames)

But when the function tries to use it, it has no value associated to it because del x removed it, so it emits an UnboundLocalError because there is no value.

raceback (most recent call last):
  File "", line 7, in <module>
  File "", line 3, in f
UnboundLocalError: local variable 'x' referenced before assignment

A NameError will occur if the symbol is unknown to the function.
Date User Action Args
2020-05-22 11:19:51pablogsalsetrecipients: + pablogsal, Mark.Shannon, oleksandr.suvorov
2020-05-22 11:19:51pablogsalsetmessageid: <>
2020-05-22 11:19:51pablogsallinkissue40728 messages
2020-05-22 11:19:51pablogsalcreate