(original) (raw)
On Sun, Nov 19, 2017 at 4:57 PM, Steven D'Aprano <steve@pearwood.info> wrote:
On Sun, Nov 19, 2017 at 08:24:00PM +0000, Mark Shannon wrote:
\> Just one comment. Could the new behaviour of attribute lookup on a
\> module be spelled out more explicitly please?
\>
\>
\> I'm guessing it is now something like:
\>
\> \`module.\_\_getattribute\_\_\` is now equivalent to:
\>
\> def \_\_getattribute\_\_(mod, name):
\> try:
\> return object.\_\_getattribute\_\_(mod, name)
\> except AttributeError:
\> try:
\> getter = mod.\_\_dict\_\_\["\_\_getattr\_\_"\]
A minor point: this should(?) be written in terms of the public
interface for accessing namespaces, namely:
getter = vars(mod)\["\_\_getattr\_\_"\]
Should it? The PEP is not proposing anything for other namespaces. What difference do you envision this way of specifying it would make?
--
--Guido van Rossum (python.org/\~guido)