Re: [Python-Dev] PEP 562

2017-11-15 Thread Koos Zevenhoven
On Wed, Nov 15, 2017 at 8:02 PM, Ethan Furman wrote: > On 11/15/2017 04:55 AM, Koos Zevenhoven wrote: > >> On Tue, Nov 14, 2017 at 10:34 PM, Ivan Levkivskyi wrote: >> > > >> Rationale >>> = >>> >>> [...] It would be convenient to simplify this >>> procedure by

Re: [Python-Dev] PEP 562

2017-11-15 Thread Ethan Furman
On 11/15/2017 04:55 AM, Koos Zevenhoven wrote: On Tue, Nov 14, 2017 at 10:34 PM, Ivan Levkivskyi wrote: Rationale = [...] It would be convenient to simplify this procedure by recognizing ``__getattr__`` defined directly in a module that would act like a normal ``__getattr__``

Re: [Python-Dev] PEP 562

2017-11-15 Thread Guido van Rossum
I think it's reasonable for the PEP to include some examples, consequences and best practices. I don't think it's reasonable for the PEP to also define the API and implementation of helper functions that might be added once the mechanisms are in place. Those are better developed as 3rd party

Re: [Python-Dev] PEP 562

2017-11-15 Thread Koos Zevenhoven
On Tue, Nov 14, 2017 at 10:34 PM, Ivan Levkivskyi wrote: ​[..]​ > Rationale > = > > It is sometimes convenient to customize or otherwise have control over > access to module attributes. A typical example is managing deprecation > warnings. Typical workarounds are

Re: [Python-Dev] PEP 562

2017-11-15 Thread Serhiy Storchaka
15.11.17 12:53, Ivan Levkivskyi пише: On 15 November 2017 at 08:43, Serhiy Storchaka > wrote: It is worth to mention that using name as a module global will bypass __getattr__. And this is intentional, otherwise calling __getattr__

Re: [Python-Dev] PEP 562

2017-11-15 Thread Ivan Levkivskyi
On 15 November 2017 at 08:43, Serhiy Storchaka wrote: > 14.11.17 22:34, Ivan Levkivskyi пише: > >> This function will be called only if ``name`` is not found in the module >> through the normal attribute lookup. >> > > It is worth to mention that using name as a module

Re: [Python-Dev] PEP 562

2017-11-14 Thread Serhiy Storchaka
14.11.17 22:34, Ivan Levkivskyi пише: This function will be called only if ``name`` is not found in the module through the normal attribute lookup. It is worth to mention that using name as a module global will bypass __getattr__. And this is intentional, otherwise calling __getattr__ for

[Python-Dev] PEP 562

2017-11-14 Thread Ivan Levkivskyi
After discussion on python-ideas, it looks this PEP moves towards a favorable decision. For a recent discussion see https://mail.python.org/pipermail/python-ideas/2017-November/047806.html. The PEP is available at https://www.python.org/dev/peps/pep-0562/ The most important recent change is the