[Python-Dev] variable name resolution in exec is incorrect (original) (raw)

Colin H hawkett at gmail.com
Thu May 27 16:14:44 CEST 2010


Just to put a couple of alternatives on the table that don't break existing code - not necessarily promoting them, or suggesting they would be easy to do -

  1. modify exec() to take an optional third argument - 'scope_type' - if it is not supplied (but locals is), then it runs as class namespace
  1. a new API exec2() which uses function namespace, and deprecating the old exec() - assuming there is agreement that function namespace makes more sense than the class namespace, because there are real use cases, and developers would generally expect this behaviour when approaching the API for the first time.


More information about the Python-Dev mailing list