-
-
Save anonymous/a5dae683e0c0a27cd4e2 to your computer and use it in GitHub Desktop.
handling keyword args
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jupiter:~/JAVA/swf-converter-conversion-node$ time perl6 -e ' | |
sub foo(*@args, *%kwargs) { | |
print %kwargs | |
} | |
foo(1,2,3,a=> 1, b => 2) | |
' | |
a 1b 2 | |
real 0m0.613s | |
user 0m0.446s | |
sys 0m0.145s | |
gregf@jupiter:~/JAVA/swf-converter-conversion-node$ | |
jupiter:~/JAVA/swf-converter-conversion-node$ time ruby -le ' | |
def foo(*args, **kwargs) | |
p kwargs | |
end | |
foo(1,2,3,{a:1, b: 2}) | |
' | |
{:a=>1, :b=>2} | |
real 0m0.038s | |
user 0m0.034s | |
sys 0m0.004s | |
jupiter:~/JAVA/swf-converter-conversion-node$ time python -c ' | |
def foo( *args, **kwargs): | |
print kwargs | |
foo(1,2,3, a=1, b=2) | |
' | |
{'a': 1, 'b': 2} | |
real 0m0.013s | |
user 0m0.005s | |
sys 0m0.008s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment