list.extend(generatorFunc())

Python list method extend(arg) can take any iterable arg, including a gen-expression or even myYieldFunc(), as illustrated in https://pythontips.com/2013/09/29/the-python-yield-keyword-explained/

li = [1,2]
li.extend(“abc”) # actually makes li become [ 1,2,’a’, ‘b’, ‘c’ ]

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s