This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author methane
Recipients methane, rhettinger, serhiy.storchaka
Date 2017-01-08.12:24:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1483878260.45.0.404118191475.issue29202@psf.upfronthosting.co.za>
In-reply-to
Content
> I'm wondering why new dict implementation don't keep the array of items compact? Original Raymond's implementation did not preserve the order after deletions, but saved items in an array without gaps. This could simplify and speed up an iteration (no need to check values for NULL, and needed to iterate fewer elements), and could get rid of reallocations in often mutated dicts. I haven't found clear explanation of this.

As far as I remember, I choose it because:

1. easy to explain, easy to discussion.

"keep insertion order" is easier than "keep insertion order unless deletion".

I want to start discussion based on most simple behavior.
But my patch was reviewed by core developers in sprint, when right before 3.6b1.

2. I want to share same implementation with OrderedDict, like PyPy.

3. Make patch compact.

If we compact dk_entries when deletion, we need another dk_indices compaction.
Before sprint, my patch wasn't reviewed for months.  I was afraid that my patch wasn't reviewed by 3.6b1.


For now, "namespace dict keeps insertion order" is language spec.
`del` shouldn't break insertion order.
History
Date User Action Args
2017-01-08 12:24:20methanesetrecipients: + methane, rhettinger, serhiy.storchaka
2017-01-08 12:24:20methanesetmessageid: <1483878260.45.0.404118191475.issue29202@psf.upfronthosting.co.za>
2017-01-08 12:24:20methanelinkissue29202 messages
2017-01-08 12:24:20methanecreate