On Sun, Apr 26, 2020 at 10:34:27PM +0100, Daniel Moisset wrote: > - we could add methods to the zip() type that provide different > behaviours. That way you could use zip(seq, seq2).shortest(), zip(seq1, > seq2).equal(), zip(seq1, seq2).longer(filler="foo") ; zip(...).shortest() > would be equivalent to zip(...). Other names might work better with > this API, I can think of zip(...).drop_tails(), zip(...).consume_all() and > zip(...).fill(). This also allows adding other possible behaviours (I > wouldn't say it's common, but at least once I've wanted to zip lists of > different length, but get shorter tuples on the tails instead of fillers).
Each of those behaviours can be handled by a simple wrapper function around zip_longest. -- Steven _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/PXCD3GP3LLAAB3HXMINP6RYTJJA2XBFR/ Code of Conduct: http://python.org/psf/codeofconduct/