3 ms·
Yes, that sucks. It's not much extra typing: def function(x, y, z): versus sub function { my ($x, $y, $x) = @_; } The overhead is only really the 'my = @
by jbert 14y ago
Yes, that sucks. It's not much extra typing:
def function(x, y, z):
versus
sub function {
my ($x, $y, $x) = @_;
}
The overhead is only really the 'my = @_;' chars, but it is annoying. On the other hand, it does allow you to do things like partially unpack args and pass the rest as a bundle to a super class.
- pyre 14y agoYou can partially unpack in Python too: def method(self, *args): a, b = args[:2] super(self).method(*args[:2]) Perl's lack of using the definition for the variables doesn't necessarily make it 'more powerful.'
- chromatic 14y agoPython's approach is very reasonable. Both Perl and Python are nicer than C varargs.