r/ProgrammerHumor • • Aug 26 '20

Python goes brrrr

Post image
59.2k Upvotes

789 comments sorted by

View all comments

Show parent comments

164

u/[deleted] Aug 26 '20 edited Aug 26 '20

''.join(itertools.product('abc', 'de')) If you want me to fix it submit a ticket, thanks.

edit: Ticket assigned, standby.

import itertools as it ''.join(it.chain.from_iterable(it.product('abc', 'de')))

2

u/murtaza64 Aug 26 '20

Does * unpacking not work with non-sequence iterables?

2

u/[deleted] Aug 26 '20

Works afaik. How were you planning on using it?

2

u/murtaza64 Aug 26 '20

''.join(it.chain(*it.product('abc', 'de')))

unless from_iterable is considered more Pythonic

→ More replies (2)