Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue23704

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:Make deques a full MutableSequence by adding index(), insert(), and copy()
Type:enhancementStage:patch review
Components:Library (Lib)Versions:Python 3.5
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To: rhettingerNosy List: python-dev, rhettinger, serhiy.storchaka
Priority:normalKeywords:patch

Created on2015-03-19 07:11 byrhettinger, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
deque_insert_index_copy3.diffrhettinger,2015-03-19 07:11First draft -- needs doc update and more testsreview
deque_insert_index_copy4.diffrhettinger,2015-03-21 04:40With docs and testreview
Messages (7)
msg238761 -(view)Author: Raymond Hettinger (rhettinger)*(Python committer)Date: 2015-03-21 04:40
Attaching an updated patch with documentation updates and tests.
msg238765 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2015-03-21 05:26
When appending fails, the deque is left in changed state. I would do it in different way. First append new item (can fail), and then make circular shift (never fail). This also should be faster (up to 2 times). Most code can be shared between rotate() and circular shift operation.
msg238769 -(view)Author: Raymond Hettinger (rhettinger)*(Python committer)Date: 2015-03-21 07:41
For now, I prefer to continue using rotate() as a primitive and am saving circular shifts for another day (likely when I start working on slices).FWIW, the only way for append() to fail is a memory error; in which case, I would ilke to stop doing any work at alll and return a soon as possible, even if it means leaving the deque in a reordered state.
msg238771 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2015-03-21 07:45
Then the patch LGTM except few nitpicks.
msg238776 -(view)Author: Roundup Robot (python-dev)(Python triager)Date: 2015-03-21 08:37
New changeset3d33be07c5a2 by Raymond Hettinger in branch 'default':Issue 23704:  Add index(), copy(), and insert() to deques.  Register deques as a MutableSequence.https://hg.python.org/cpython/rev/3d33be07c5a2
msg238777 -(view)Author: Raymond Hettinger (rhettinger)*(Python committer)Date: 2015-03-21 08:39
Thank you for looking it over.
msg238779 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2015-03-21 09:28
Did you noticed my comments on Rietveld? You can found Rietveld messages in the Spam folder.
History
DateUserActionArgs
2022-04-11 14:58:14adminsetgithub: 67892
2015-03-21 09:28:50serhiy.storchakasetmessages: +msg238779
2015-03-21 08:39:04rhettingersetstatus: open -> closed
resolution: fixed
messages: +msg238777
2015-03-21 08:37:48python-devsetnosy: +python-dev
messages: +msg238776
2015-03-21 07:45:17serhiy.storchakasetmessages: +msg238771
2015-03-21 07:41:12rhettingersetmessages: +msg238769
2015-03-21 05:26:49serhiy.storchakasetnosy: +serhiy.storchaka
messages: +msg238765
2015-03-21 04:40:10rhettingersetfiles: +deque_insert_index_copy4.diff

messages: +msg238761
2015-03-19 07:26:16rhettingersetassignee:rhettinger
2015-03-19 07:11:27rhettingercreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp