Download izip python12/19/2023 ![]() X, y = starzip(itertools.izip(range(10), range(10))) Starzip(itertools.izip(range(10), range(10))) >x, y = itertools.izip(*itertools.izip(range(10), range(10))) How about using iter() to get another solution like the following: Seems like a bit of work for the inverse of izip though so I'll wait to see ifĪnyone else has a better solution. x, y = starzip(itertools.izip(range(10), range(10))) Starzip = lambda iterables: ((tuple for tuple in itr) for i, itr inĮnumerate(itertools.tee(iterables))) starzip(itertools.izip(range(10), range(10))) Sorry to respond to myself, but after playing around with itertools for a Steven Bethard > writes: What's the inverse of izip? Of course, I could use zip(*) or izip(*), Satchidanand Haridas (sharidas at zeomega dot com) I want to convert an iterator of tuples into a tuple of iterators.Ī = itertools.izip(*itertools.izip(range(10),range(10) )) X, y = itertools.izip(*itertools.izip(range(10), range(10))) What's the inverse of izip? Of course, I could use zip(*) or izip(*), So I know that zip(*) is the inverse of zip(), e.g.:
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |