Skip to content

Commit f01ba07

Browse files
committed
added more idiomatic named parameters
1 parent a6f804b commit f01ba07

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

doc/Language/py-nutshell.pod6

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ the return value:
320320
Python 2 functions can be called with positional arguments
321321
or keyword arguments. These are determined by the caller.
322322
In Python 3, some arguments may be "keyword only".
323-
IN Perl 6 positional and named arguments are determined
323+
In Perl 6, positional and named arguments are determined
324324
by the signature of the routine.
325325
326326
Python
@@ -345,6 +345,7 @@ Named parameters start with a colon:
345345
say $word for ^$times
346346
}
347347
speak(word => 'hi',times => 2);
348+
speak(:word<hi>, :times<2>); # Alternative, more idiomatic
348349
349350
Perl 6 supports multiple dispatch, so several signatures
350351
could be made available by declaring a routine as a C<multi>.
@@ -356,7 +357,7 @@ could be made available by declaring a routine as a C<multi>.
356357
speak($word,$times);
357358
}
358359
speak('hi', 2);
359-
speak(word => 'hi',times => 2);
360+
speak(:word<hi>, :times<2>);
360361
361362
Named parameters can be sent using a variety of formats:
362363

0 commit comments

Comments
 (0)