3 ms·
How is it more "readable"? The two are just as readable. What do you do with your first example if you have a list (generated at runtime, not a static one) to
by uxp8u61q 3y ago
How is it more "readable"? The two are just as readable.
What do you do with your first example if you have a list (generated at runtime, not a static one) to pass to the function? This wouldn't work (imagine the first line is more complicated):
l = (1,2,3)
print(l)
- BurningFrog 3y agoIt's more readable, for my brain at least, because there is less distracting syntax cruft lying around.
- uxp8u61q 3y agoYou're distracted by the parentheses? Really?
- BurningFrog 3y agoAbsolutely! Something I keep relearning is that people are different, sometimes in ways hard for me to comprehend :)
- zem 3y agothat's what the splat operator is for - it unpacks a list into separate arguments. in this case e.g. xs = (1, 2, 3) f(*xs) is equivalent to f(1, 2, 3), not f((1, 2, 3))
- uxp8u61q 3y agoAnd that's readable?