Issue1336

classification
Title: PyDeque should likely subclass PySequence
Type: rfe Severity: minor
Components: Core Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: fwierzbicki, pjenvey, thatmattbone
Priority: Keywords: patch

Created on 2009-05-03.21:28:03 by pjenvey, last changed 2009-07-28.05:58:21 by pjenvey.

Files
File name Uploaded Description Edit Remove
deque_repeated_code.patch thatmattbone, 2009-07-24.01:31:38 deque extends pysequence, reduces duplication
Messages
msg4629 (view) Author: Philip Jenvey (pjenvey) Date: 2009-05-03.21:28:02
PyDeque obviously cut and pasted much of PySequence, it looks very likely 
that it should be subclassing it instead.

Its tests also run through some of tests.seq_tests (but not all of them).
msg4938 (view) Author: Matt Bone (thatmattbone) Date: 2009-07-24.01:31:38
Here's my stab at a patch.  The tests pass, but it's probably all that
useful (the cpython deque does not extend sequence).
msg4954 (view) Author: Philip Jenvey (pjenvey) Date: 2009-07-28.05:58:20
Thanks for this, a couple things:

no tabs, just 4 space indents

pyget looks like cut and paste of getNode, I think they need 
refactoring..

Actually I think getNode is probably unnecessary if we have a working 
pyget. Then the PySequence __get/set/delitem__ methods can do all the 
work for us and we wouldn't have to override them to use getNode.

Those PySequence methods should also do the work of the first few lines 
of getNode for us (the adjusting of the index and throwing an IndexError 
if it's invalid) via PySequence.delegator
History
Date User Action Args
2009-07-28 05:58:22pjenveysetmessages: + msg4954
2009-07-26 14:01:39fwierzbickisetnosy: + fwierzbicki
2009-07-24 01:31:40thatmattbonesetfiles: + deque_repeated_code.patch
keywords: + patch
messages: + msg4938
nosy: + thatmattbone
2009-05-03 21:28:03pjenveycreate