You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/tutorial.rst
+11
Original file line number
Diff line number
Diff line change
@@ -229,6 +229,17 @@ Set a function parameter by name with a ``:keyword``::
229
229
230
230
(test 1 2 :d "y") ; => [1, 2, None, 'y', ()]
231
231
232
+
Keyword arguments may be placed before or among positional arguments, with the
233
+
same effect as putting all the positional arguments first::
234
+
235
+
(test 1 :d "y" 2) ; => [1, 2, None, 'y', ()]
236
+
237
+
You can unpack iterable objects into positional arguments with ``#*`` (:hy:func:`unpack-iterable`), or dictionary-like objects into keyword arguments with ``#**`` (:hy:func:`unpack-mapping`)::
238
+
239
+
(setv x [1 2 3])
240
+
(setv y {"d" 4})
241
+
(test #* x #** y) ; => [1, 2, 3, 4, ()]
242
+
232
243
Note that unlike Python, Hy doesn't always evaluate function arguments (or the
233
244
items in a literal list, or the items in a literal dictionary, etc.) :ref:`in
234
245
the order they appear in the code <order-of-eval>`. But you can always force a
0 commit comments