DEV Community

Discussion on: What the heck is Unpacking and Packing of Sequences in Python?

Collapse
 
srleyva profile image
Stephen Leyva (He/Him) • Edited

This is a great article! I've also found variadic unpacking to be helpful when the number of variables is unknown:

>>> thing_1, thing_2, *rest_of_the_things = [ 1, 2, 3, 4, 5, 6, 7 ]
>>> thing_1
1
>>> thing_2
2
>>> rest_of_the_things
[3, 4, 5, 6, 7]
>>>

Collapse
 
mojemoron profile image
Micheal Ojemoron

Very nice