Unsure how many values you want to unpack in #Python? Use * to get a list of flexible length:

x = [10, 20, 30, 40, 50]

a,b,c = x # error!
a,b,*c = x # c is [30, 40, 50]
a,*b,c = x # b is [20, 30, 40]
*a,b,c = x # a is [10, 20, 30]

Note: You can only have one * variable.

@Reuven thanks for sharing! I did not know this.

Can be an anti pattern though, and wouldn’t that fail in type checking?

@pa glad you liked it! I'm pretty sure that you can add type hints to these variables. Plus, the sequence from which you're unpacking will have (usually one) set type. So it seems OK to me, but I might well be missing something.