
Hello, I posted on python-dev a question regarding builtin vars() vs .__dict__ attribute dichotomy: https://mail.python.org/archives/list/python-dev@python.org/thread/JAFIBBUU5... It could as well be one among the earliest cases of the violation of "There should be one-- and preferably only one --obvious way to do it." Such earlier, that it could as well turn out that this principle was never thoroughly followed by Python at all. Anyway, how the question pops up, is that there's very rare when there's a need to access *writable* object namespace as dictionary. One of such cases is executing code in a module context, where you need to pass module's globals to exec(), and so I wonder what's "the most canonical way" of getting that - var(mod) or mod.__dict__. But thinking about it, the problem lies on the exec()'s side. If exec could take a module object directly as its "globals" param, there wouldn't be a need to expose internal namespace implementation of the module object. So, I wonder what old-timers would think of the following signature: exec(object[, globals_or_module[, locals]]) https://docs.python.org/3/library/functions.html#exec -- Best regards, Paul mailto:pmiscml@gmail.com