[issue31099] Timer error pop from empty deque/list

2017-08-01 Thread Randy Henderson
Changes by Randy Henderson : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___

[issue31099] Timer error pop from empty deque/list

2017-08-01 Thread Randy Henderson
Randy Henderson added the comment: You're right. I was expecting the code in stmt to be run only once, but I just discovered in the documentation that the default is for it to be run one million times. I provided the argument 'number=1' to the timeit() method and am now getting the behavior I

[issue31099] Timer error pop from empty deque/list

2017-08-01 Thread R. David Murray
R. David Murray added the comment: Perhaps I'm missing something, but isn't this to be expected? Timer will run d.popleft() repeatedly until you get the error you see because the list is empty. Are you thinking that setup is run each time? That would defeat its purpose. -- nosy:

[issue31099] Timer error pop from empty deque/list

2017-08-01 Thread Randy Henderson
New submission from Randy Henderson: Even when a deque is populated in the Timer setup parameter, the interpreter gives "IndexError: pop from an empty deque". IndexError is generated for lists as well. >>> Timer(stmt='d.popleft()',setup='d=deque([1,2,3])',globals=globals()).timeit()