On Mon, Oct 24, 2016 at 10:22 AM, Steven D'Aprano <st...@pearwood.info> wrote:
> Right. But you're missing the point of Danilo's proposal. He isn't
> asking for a function to "jump to the end" of an iterator. Look at his
> example. The word "last" is a misnomer: he seems to me talking
> about having a special variable in comprehensions that holds the
> *previous* value of the loop variable, with special syntax to set its
> FIRST value, before the loop is entered. So "last" is a misleading name,
> unless you understand it as "last seen" rather than "very last, at the
> end".
>

Sounds like the PostgreSQL "lag" function [1]. Perhaps that's a better
name? Conceptually, what you have is another iteration point that lags
behind where you currently are.

ChrisA

[1] https://www.postgresql.org/docs/current/static/functions-window.html
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to