Re: [Python-Dev] Idea: Dictionary references

2015-12-17 Thread Maciej Fijalkowski
You can very easily implement this with version tags on the globals dictionaries - means that the dictionaries have versions and the guard checking if everything is ok just checks the version tag on globals. Generally speaking, such optimizations have been done in the past (even in places like

Re: [Python-Dev] Idea: Dictionary references

2015-12-17 Thread Steven D'Aprano
On Thu, Dec 17, 2015 at 12:53:13PM +0100, Victor Stinner quoted: > 2015-12-17 11:54 GMT+01:00 Franklin? Lee : > > Each function keeps an indirect, automagically updated > > reference to the current value of the names they use, Isn't that a description of

[Python-Dev] pypi simple index

2015-12-17 Thread Carlos Barera
Hi, I'm using install_requires in setup.py to specify a specific package my project is dependant on. When running python setup.py install, apparently the simple index is used as an older package is taken from pypi. While in https://pypi.python.org/pypi, there's a newer package. When installing

Re: [Python-Dev] Idea: Dictionary references

2015-12-17 Thread Franklin? Lee
(Previous thread was here, by the way: https://mail.python.org/pipermail/python-dev/2015-December/142437.html) On Thu, Dec 17, 2015 at 8:48 AM, Steven D'Aprano wrote: > On Thu, Dec 17, 2015 at 12:53:13PM +0100, Victor Stinner quoted: >> 2015-12-17 11:54 GMT+01:00 Franklin?

Re: [Python-Dev] Idea: Dictionary references

2015-12-17 Thread Victor Stinner
2015-12-17 16:38 GMT+01:00 Franklin? Lee : > Yeah, maybe it's out of the scope of bytecode optimization. But I > think this would make guards unnecessary, since once a name is found, > there's a quick way to refer to it. FAT Python requires and supports various

Re: [Python-Dev] Idea: Dictionary references

2015-12-17 Thread Franklin? Lee
On Thu, Dec 17, 2015 at 6:53 AM, Victor Stinner wrote: > 2015-12-17 11:54 GMT+01:00 Franklin? Lee : >> My suggestion should improve *all* function calls which refer to >> outside names. > > Ok, I now think that you should stop hijacking the

[Python-Dev] pypi simple index

2015-12-17 Thread Carlos Barera
Hi, I'm using install_requires in setup.py to specify a specific package my project is dependant on. When running python setup.py install, apparently the simple index is used as an older package is taken from pypi. While in https://pypi.python.org/pypi, there's a newer package. When installing

Re: [Python-Dev] pypi simple index

2015-12-17 Thread Brett Cannon
PyPI questions are best directed towards the distutils-sig as they manage PyPI and not python-dev. On Thu, 17 Dec 2015 at 08:20 Carlos Barera wrote: > Hi, > > I'm using install_requires in setup.py to specify a specific package my > project is dependant on. > When

Re: [Python-Dev] Idea: Dictionary references

2015-12-17 Thread Andrew Barnert via Python-Dev
On Dec 17, 2015, at 07:38, Franklin? Lee wrote: > > The nested dictionaries are only for nested scopes (and inner > functions don't create nested scopes). Nested scopes will already > require multiple lookups in parents. I think I understand what you're getting at

Re: [Python-Dev] pypi simple index

2015-12-17 Thread Robert Collins
On 18 December 2015 at 06:13, Carlos Barera wrote: > Hi, > > I'm using install_requires in setup.py to specify a specific package my > project is dependant on. > When running python setup.py install, apparently the simple index is used > as an older package is taken from

Re: [Python-Dev] Idea: Dictionary references

2015-12-17 Thread Franklin? Lee
On Thu, Dec 17, 2015 at 11:50 AM, Victor Stinner wrote: > I don't understand how you plan to avoid guards. The purpose of guards > is to respect the Python semantic by falling back to the "slow" > bytecode if something changes. So I don't understand your idea of >

Re: [Python-Dev] Idea: Dictionary references

2015-12-17 Thread Franklin? Lee
On Thu, Dec 17, 2015 at 12:30 PM, Andrew Barnert wrote: > On Dec 17, 2015, at 07:38, Franklin? Lee > wrote: >> >> The nested dictionaries are only for nested scopes (and inner >> functions don't create nested scopes). Nested scopes will already

Re: [Python-Dev] Idea: Dictionary references

2015-12-17 Thread Andrew Barnert via Python-Dev
On Thursday, December 17, 2015 11:19 AM, Franklin? Lee wrote: > ... > as soon as I figure out how descriptors actually work... I think you need to learn what LOAD_ATTR and the machinery around it actually does before I can explain why trying to optimize it

Re: [Python-Dev] Idea: Dictionary references

2015-12-17 Thread Victor Stinner
Le vendredi 18 décembre 2015, Andrew Barnert via Python-Dev < python-dev@python.org> a écrit : > > >> Builtins do two dict lookups. > > > > Two? > > Actually, I guess three: first you fail to find the name in globals, then > you find __builtins__ in globals, then you find the name in __builtins__

Re: [Python-Dev] Idea: Dictionary references

2015-12-17 Thread Victor Stinner
2015-12-17 23:17 GMT+01:00 Andrew Barnert via Python-Dev : > Builtins do two dict lookups. > > So, the only thing you can optimize there is builtins. But maybe that's worth > it. FYI I implemented an optimization in FAT Python to avoid lookups for builtin functions,

Re: [Python-Dev] Idea: Dictionary references

2015-12-17 Thread Franklin? Lee
I already know that we can't use recursion, because it bypasses MRO. I'm also not yet sure whether it makes sense to use refs for classes in the first place. As I understood it, an attribute will resolve in this order: - __getattribute__ up the MRO. (raises AttributeError) - __dict__ up the MRO.

Re: [Python-Dev] Idea: Dictionary references

2015-12-17 Thread Andrew Barnert via Python-Dev
On Dec 17, 2015, at 13:37, Andrew Barnert via Python-Dev wrote: > > On Thursday, December 17, 2015 11:19 AM, Franklin? Lee > wrote: > > >> ... >> as soon as I figure out how descriptors actually work... > > > I think you need to learn

Re: [Python-Dev] Idea: Dictionary references

2015-12-17 Thread Franklin? Lee
On Thu, Dec 17, 2015 at 6:41 PM, Franklin? Lee wrote: > Then Descriptors are in the dict, so MIGHT benefit from refcells. The > memory cost might be higher, though. Might be worse than the savings, I mean. ___ Python-Dev

Re: [Python-Dev] Idea: Dictionary references

2015-12-17 Thread Andrew Barnert via Python-Dev
On Dec 17, 2015, at 15:41, Franklin? Lee wrote: > > I already know that we can't use recursion, because it bypasses MRO. > I'm also not yet sure whether it makes sense to use refs for classes > in the first place. > > As I understood it, an attribute will resolve

Re: [Python-Dev] Idea: Dictionary references

2015-12-17 Thread Chris Angelico
On Fri, Dec 18, 2015 at 2:37 PM, Andrew Barnert via Python-Dev wrote: > If __getattribute__ raises an AttributeError (or isn't found, but that only > happens in special cases like somehow calling a method on a type that hasn't > been constructed) Wow. How do you do that?

Re: [Python-Dev] Idea: Dictionary references

2015-12-17 Thread Victor Stinner
2015-12-17 11:54 GMT+01:00 Franklin? Lee : > My suggestion should improve *all* function calls which refer to > outside names. Ok, I now think that you should stop hijacking the FAT Python thread. I start a new thread. IMHO your dictionary reference idea is

Re: [Python-Dev] Third milestone of FAT Python

2015-12-17 Thread Franklin? Lee
On Wed, Dec 16, 2015 at 2:01 AM, Victor Stinner wrote: > Le mercredi 16 décembre 2015, Franklin? Lee > a écrit : >> >> I am confident that the time overhead and the savings will beat the >> versioning dict. The versioning dict method has