3 ms·
> And you have to do all the work of pulling apart *args to get the data you want, including manually throwing errors if you didn't get what you expected. Res
by bloblaw 5y ago
> And you have to do all the work of pulling apart *args to get the data you want, including manually throwing errors if you didn't get what you expected.
Respectfully, isn't this just the same amount of work to define named function arguments?
In Perl you do the work of unpacking the array and then validating data. In Python you have the work of defining the function arguments and then validating the received data.
> Python lets your function signature have required positional arguments, variable positional arguments (*args) AND variable keyword args (*kwargs). And everyone uses these features because it makes programming much more pleasant and manageable.
Perl supports this as well. Same functionality as *kwargs is found by passing a hash to a subroutine. And of course *args is analogous to how Perl subroutines were designed to work.