Skip to content

Commit 42d1f40

Browse files
committed
Mention unpacking in the tutorial
1 parent c223576 commit 42d1f40

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/tutorial.rst

+6
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,12 @@ same effect as putting all the positional arguments first::
234234

235235
(test 1 :d "y" 2) ; => [1, 2, None, 'y', ()]
236236

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+
237243
Note that unlike Python, Hy doesn't always evaluate function arguments (or the
238244
items in a literal list, or the items in a literal dictionary, etc.) :ref:`in
239245
the order they appear in the code <order-of-eval>`. But you can always force a

0 commit comments

Comments
 (0)