Mike Driscoll
Mike Driscoll

@driscollis

5 Tweets Jan 28, 2023
PEP 448 added some neat unpacking generalizations to #Python in 3.5
You can read about them here or check out my mini-thread!
python.org
๐Ÿงต๐Ÿ‘‡๐Ÿ
You can use the * iterable unpacking operator and ** dictionary unpacking operators to allow unpacking in more positions, an arbitrary number of times, and in additional circumstances. ๐Ÿ๐Ÿ”ฅ
Here are a couple of examples:
Be careful though or you might get stung by #Python ๐Ÿ๐Ÿ
In dictionary unpacking, later values will always override earlier ones:
Need a way to combine a tuple, list and range object into a single #Python list?
Use an unpacking generalizaion!
You can read more about this in my short tutorial @mousevspython here:
blog.pythonlibrary.org

Loading suggestions...