On Mon, Oct 24, 2016 at 10:22 AM, Steven D'Aprano firstname.lastname@example.org 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 . Perhaps that's a better name? Conceptually, what you have is another iteration point that lags behind where you currently are.