[Python-Dev] Comment on PEP 562 (Module __getattr__ and __dir__)

Guido van Rossum guido at python.org
Mon Nov 20 14:51:26 EST 2017


Yeah, I don't think there's an action item here except *maybe* changes to
the wording of the PEP. Ivan?

On Mon, Nov 20, 2017 at 12:33 AM, Serhiy Storchaka <storchaka at gmail.com>
wrote:

> 20.11.17 03:02, Guido van Rossum пише:
>
>> Serhiy's definition sounds recursive (defining __getattr__ to define the
>> behavior of __getattr__) but Mark's suggestion makes his intention unclear
>> since the error message is still the same.
>>
>
> It is recursive only when the '__dict__' attribute is not defined. I
> assumed that it is defined for simplicity. And if isn't defined
> hasattr(self, '__dict__') will cause a recursion too.
>
> In any case the real C code handles this more carefully and effectively.
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/guido%
> 40python.org
>



-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171120/711222eb/attachment-0001.html>


More information about the Python-Dev mailing list