Skip to content Skip to sidebar Skip to footer
Showing posts with the label Iterable Unpacking

Python: Is There Syntax-level Support For Unpacking, From Tuples, The Arguments To An *anonymous* Function?

Suppose we have the following: args = (4,7,5) def foo(a,b,c): return a*b%c Python conveniently all… Read more Python: Is There Syntax-level Support For Unpacking, From Tuples, The Arguments To An *anonymous* Function?

Is It Possible To Assign A Default Value When Unpacking?

I have the following: >>> myString = 'has spaces' >>> first, second = myS… Read more Is It Possible To Assign A Default Value When Unpacking?

How To Define A Tuple Of Randint Without Repeating Code?

I often get to use tuples of randint for color-values and such like (a, b, c) = randint(0, 255), ra… Read more How To Define A Tuple Of Randint Without Repeating Code?