Tim Peters <t...@python.org> added the comment:
I agree Raymond's `before_and_after()` looks like an elegant, efficient, and usable approach to this. One minor nit: there's no need for the `iter()` call in: yield from iter(transition) Indeed, it confused me at first, because `yield from x` does its own `iter(x)` call under the covers, and since everyone knows that ;-) , I wondered what deep trickery calling it again was intended to pull off. But I persuaded myself there was no such subtle intent - it's just redundant. ---------- nosy: +tim.peters _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44571> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com