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 steven.daprano
Recipients Padmanabhan.Tr, ezio.melotti, mrabarnett, steven.daprano
Date 2015-06-06.11:42:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1433590933.84.0.798857554924.issue24392@psf.upfronthosting.co.za>
In-reply-to
Content
The behaviour is correct, this is not a bug. Each time you pop from aa, the following items move down one space. Then, the next time you pop, the items have moved:

['a0', 'b1', 'c2', 'd3', 'e4', 'f5', 'g6', 'h7', 'i8', 'j9', 'k10', 'l11']
d3 is the third item and gets popped;

['a0', 'b1', 'c2', 'e4', 'f5', 'g6', 'h7', 'i8', 'j9', 'k10', 'l11']
g6 is the fifth item and gets popped;

['a0', 'b1', 'c2', 'e4', 'f5', 'h7', 'i8', 'j9', 'k10', 'l11']
j9 is the seventh item and gets popped.


To get the result you want, you can use slicing:

aa[3:9:2]
=> returns ['d3', 'f5', 'h7']

then

del aa[3:9:2]
=> leaves ['a0', 'b1', 'c2', 'e4', 'g6', 'i8', 'j9', 'k10', 'l11']
History
Date User Action Args
2015-06-06 11:42:13steven.dapranosetrecipients: + steven.daprano, ezio.melotti, mrabarnett, Padmanabhan.Tr
2015-06-06 11:42:13steven.dapranosetmessageid: <1433590933.84.0.798857554924.issue24392@psf.upfronthosting.co.za>
2015-06-06 11:42:13steven.dapranolinkissue24392 messages
2015-06-06 11:42:13steven.dapranocreate