On Sat, Dec 1, 2018 at 1:11 AM Chris Angelico <ros...@gmail.com> wrote:
> On Sat, Dec 1, 2018 at 10:55 AM Morten W. Petersen <morp...@gmail.com> > wrote: > > But this raises the question of how to write Python code, > > short and sweet, that could handle infinite iterators in > > such an unpack with multiple variables to assign to. > > > > Which I guess is mostly theoretical, as there are other > > ways of designing code to avoid needing to unpack > > an infinite iterator using the * prefix. > > It could only be done with the cooperation of the iterable in > question. For instance, a range object could implement a "remove > first" operation that does this, and several itertools types wouldn't > need to change at all. But it can't be done generically other than the > way it now is (pump the iterator the rest of the way). > I wasn't able to follow this, could you elaborate? Regards, Morten -- Videos at https://www.youtube.com/user/TheBlogologue Twittering at http://twitter.com/blogologue Blogging at http://blogologue.com Playing music at https://soundcloud.com/morten-w-petersen Also playing music and podcasting here: http://www.mixcloud.com/morten-w-petersen/ On Google+ here https://plus.google.com/107781930037068750156 On Instagram at https://instagram.com/morphexx/ -- https://mail.python.org/mailman/listinfo/python-list