On Wed, Dec 24, 2014 at 1:34 PM, Rustom Mody <rustompm...@gmail.com> wrote:
> +1 for the slice in succinct form

Not only more succinct but also more correct. The purpose of islice is to
slice arbitrary iterables as opposed to just sequences. But this function
requires a reentrant iterable anyway and returns garbage if you pass it an
iterator, so there's really no reason for it here. The version using slice
notation on the other hand will raise a TypeError if you pass it an
iterator or anything else that can't be sliced, which is preferable to
silently returning incorrect results.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to