Re: [Python-Dev] Review request: issue 27350, compact ordered dict

2016-08-18 Thread Armin Rigo
Hi Inada,

On 10 August 2016 at 18:52, INADA Naoki  wrote:
> a. dict has one additional word and support ring internally.
> b. OrderedDict reimplements many APIs (iterating, resizing, etc...) to 
> support ring.

There is a solution "c." which might be simpler.  Let's think first
about what occurs with a normal dict (with your patch, or in PyPy) if
the user repeatedly pops the oldest item and adds a new item.  In this
case, the dict will accumulate dead entries at the start of the list,
and when it gets too many of them, it needs to make a complete copy of
the list to get rid of them.  (This is not a problem as it is
amortized over many pop-and-add operations.)

So now, when the user calls move_to_end(last=False), we can do the
opposite.  We look if there are already some deleted entries at the
start, and if so, we add the item at the place of the last deleted
entry.  If there aren't any, then we make a copy of the list that
*adds* some number of entries at the start, which are initially marked
as deleted...


A bientôt,

Armin.
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] review request: anti-registration of ABCs

2016-08-18 Thread Ivan Levkivskyi
I have unsuccessfully tried to ping the issue http://bugs.python.org/
issue25958 on "anti-registration" of implicit ABCs by setting attributes to
None.

Guido said: "But with the indicated fixes, I think this good to go (for
Python 3.6)"

I have manually "rebased" the previous patch by Andrew Barnert taking into
account part of the work that has been done on Reversible and fixing final
minor comments.

I would like this to land in time for 3.6, could someone please review the
latest patch and check that everything is OK?

--
Ivan
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] review request: anti-registration of ABCs

2016-08-18 Thread Guido van Rossum
Looking...

On Thu, Aug 18, 2016 at 1:16 AM, Ivan Levkivskyi 
wrote:

> I have unsuccessfully tried to ping the issue
> http://bugs.python.org/issue25958 on "anti-registration" of implicit ABCs
> by setting attributes to None.
>
> Guido said: "But with the indicated fixes, I think this good to go (for
> Python 3.6)"
>
> I have manually "rebased" the previous patch by Andrew Barnert taking into
> account part of the work that has been done on Reversible and fixing final
> minor comments.
>
> I would like this to land in time for 3.6, could someone please review the
> latest patch and check that everything is OK?
>
> --
> Ivan
>



-- 
--Guido van Rossum (python.org/~guido)
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] review request: anti-registration of ABCs

2016-08-18 Thread Guido van Rossum
Committed. Someone please watch the buildbots.

On Thu, Aug 18, 2016 at 8:12 AM, Guido van Rossum  wrote:

> Looking...
>
> On Thu, Aug 18, 2016 at 1:16 AM, Ivan Levkivskyi 
> wrote:
>
>> I have unsuccessfully tried to ping the issue
>> http://bugs.python.org/issue25958 on "anti-registration" of implicit
>> ABCs by setting attributes to None.
>>
>> Guido said: "But with the indicated fixes, I think this good to go (for
>> Python 3.6)"
>>
>> I have manually "rebased" the previous patch by Andrew Barnert taking
>> into account part of the work that has been done on Reversible and fixing
>> final minor comments.
>>
>> I would like this to land in time for 3.6, could someone please review
>> the latest patch and check that everything is OK?
>>
>> --
>> Ivan
>>
>
>
>
> --
> --Guido van Rossum (python.org/~guido)
>



-- 
--Guido van Rossum (python.org/~guido)
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com