aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorArun Isaac2021-07-05 00:06:15 +0530
committerArun Isaac2021-07-05 00:06:15 +0530
commit1880f7a2fed157220dd485f9e8ccd9f546996978 (patch)
tree443dea75dff54992453585677bae27691810ad00 /doc
parentb767ab89d0bed2f612ad057b198a3757b81f408f (diff)
downloadccwl-1880f7a2fed157220dd485f9e8ccd9f546996978.tar.gz
ccwl-1880f7a2fed157220dd485f9e8ccd9f546996978.tar.lz
ccwl-1880f7a2fed157220dd485f9e8ccd9f546996978.zip
doc: Add python named arguments example.
* doc/ccwl.skb (Tutorial)[Important concepts]: Add python named arguments example.
Diffstat (limited to 'doc')
-rw-r--r--doc/ccwl.skb13
1 files changed, 8 insertions, 5 deletions
diff --git a/doc/ccwl.skb b/doc/ccwl.skb
index b15f861..80ed7c1 100644
--- a/doc/ccwl.skb
+++ b/doc/ccwl.skb
@@ -56,11 +56,14 @@ function is significant. The position of each argument determines
which formal argument it gets mapped to. For example, passing
positional arguments in Scheme looks like])
(prog :line #f [(foo 1 2)])
- (p [In a language that supports named arguments, the order of
-arguments is not significant. Each argument explicitly names the
-formal argument it gets mapped to. For example, in Scheme, passing
-named arguments may look like]
- (prog :line #f [(foo #:bar 1 #:baz 2)])))
+ (p [However, in a language that supports named arguments (say,
+Scheme or Python), the order of arguments is not significant. Each
+argument explicitly names the formal argument it gets mapped to. For
+example, in Scheme, passing named arguments may look like ,(code "(foo
+#:bar 1 #:baz 2)") and is equivalent to ,(code "(foo #:baz 2 #:bar
+1)"). Likewise, in Python, passing named arguments looks like
+,(code "foo(bar=1, baz=2)") and is equivalent to ,(code "foo(baz=2,
+bar=1)").]))
(subsection :title [Multiple function arguments and return values]
(p [In most languages, functions accept multiple input
arguments but only return a single output value. However, in CWL, a