On Wed, Apr 29, 2015 at 3:45 PM, Cecil Westerhof <ce...@decebal.nl> wrote: > Op Wednesday 29 Apr 2015 21:57 CEST schreef Ian Kelly: >> And although it's not clear to me what this is supposed to be doing, >> you probably no longer need the middle term if the intention is to >> continue deleting all the way to the end of the list (if it is then >> I think you have a bug in the existing implementation, since the >> last item in the list can never be deleted). > > What do you mean by this? Executing: > lucky_numbers(5) > gives: > [1, 3] > > So the last element (5) is deleted.
Off by one error on my part. This is why negative skip values on ranges and slices are not recommended: they're confusing. :-) In that case you can definitely omit the middle term of the slice, which will be both more concise and clearer in intent, though probably not significantly faster. -- https://mail.python.org/mailman/listinfo/python-list