Re: [Python-ideas] LOAD_NAME/LOAD_GLOBAL should be use getattr()

2017-09-14 Thread C Anthony Risinger
On Thu, Sep 14, 2017 at 8:07 AM, Steven D'Aprano wrote: > On Wed, Sep 13, 2017 at 12:24:31PM +0900, INADA Naoki wrote: > > I'm worring about performance much. > > > > Dict has ma_version from Python 3.6 to be used for future optimization > > including global caching. > >

Re: [Python-ideas] LOAD_NAME/LOAD_GLOBAL should be use getattr()

2017-09-14 Thread Chris Angelico
On Fri, Sep 15, 2017 at 12:08 AM, Serhiy Storchaka wrote: > 13.09.17 23:07, Lucas Wiman пише: >> >> On Wed, Sep 13, 2017 at 11:55 AM, Serhiy Storchaka > > wrote: >> >> [...] Calling __getattr__() will slow down the access

Re: [Python-ideas] LOAD_NAME/LOAD_GLOBAL should be use getattr()

2017-09-14 Thread Serhiy Storchaka
13.09.17 23:07, Lucas Wiman пише: On Wed, Sep 13, 2017 at 11:55 AM, Serhiy Storchaka > wrote: [...] Calling __getattr__() will slow down the access to builtins. And there is a recursion problem if module's __getattr__() uses

Re: [Python-ideas] LOAD_NAME/LOAD_GLOBAL should be use getattr()

2017-09-14 Thread Steven D'Aprano
On Wed, Sep 13, 2017 at 12:24:31PM +0900, INADA Naoki wrote: > I'm worring about performance much. > > Dict has ma_version from Python 3.6 to be used for future optimization > including global caching. > Adding more abstraction layer may make it difficult. Can we make it opt-in, by replacing the

Re: [Python-ideas] LOAD_NAME/LOAD_GLOBAL should be use getattr()

2017-09-13 Thread Lucas Wiman
On Wed, Sep 13, 2017 at 11:55 AM, Serhiy Storchaka wrote: > [...] Calling __getattr__() will slow down the access to builtins. And > there is a recursion problem if module's __getattr__() uses builtins. > The first point is totally valid, but the recursion problem doesn't

Re: [Python-ideas] LOAD_NAME/LOAD_GLOBAL should be use getattr()

2017-09-13 Thread Serhiy Storchaka
12.09.17 19:17, Neil Schemenauer пише: This is my idea of making module properties work. It is necessary for various lazy-loading module ideas and it cleans up the language IMHO. I think it may be possible to do it with minimal backwards compatibility problems and performance regression. To

Re: [Python-ideas] LOAD_NAME/LOAD_GLOBAL should be use getattr()

2017-09-12 Thread Nick Coghlan
On 13 September 2017 at 02:17, Neil Schemenauer wrote: > Introducing another special feature of modules to make this work is > not the solution, IMHO. We should make module namespaces be more > like instance namespaces. We already have a mechanism and it is >

Re: [Python-ideas] LOAD_NAME/LOAD_GLOBAL should be use getattr()

2017-09-12 Thread INADA Naoki
I'm worring about performance much. Dict has ma_version from Python 3.6 to be used for future optimization including global caching. Adding more abstraction layer may make it difficult. When considering lazy loading, big problem is backward compatibility. For example, see

Re: [Python-ideas] LOAD_NAME/LOAD_GLOBAL should be use getattr()

2017-09-12 Thread Neil Schemenauer
On 2017-09-12, Eric Snow wrote: > Yeah, good luck! :). If I weren't otherwise occupied with my own crazy > endeavor I'd lend a hand. No problem. It makes sense to have a proof of concept before spending time on a PEP. If the idea breaks too much old code it is not going to happen. So, I will

Re: [Python-ideas] LOAD_NAME/LOAD_GLOBAL should be use getattr()

2017-09-12 Thread Eric Snow
On Sep 12, 2017 10:17 AM, "Neil Schemenauer" wrote: Introducing another special feature of modules to make this work is not the solution, IMHO. We should make module namespaces be more like instance namespaces. We already have a mechanism and it is getattr on

[Python-ideas] LOAD_NAME/LOAD_GLOBAL should be use getattr()

2017-09-12 Thread Neil Schemenauer
This is my idea of making module properties work. It is necessary for various lazy-loading module ideas and it cleans up the language IMHO. I think it may be possible to do it with minimal backwards compatibility problems and performance regression. To me, the main issue with module properties