Skip to content

Commit

Permalink
Docs: update news and attribute access api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
allison-casey committed Jul 20, 2021
1 parent 44325f3 commit 8ed4424
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ Bug Fixes
* `let` should no longer re-evaluate default arguments.
* Improved error messages for illegal uses of `finally` and `else`.

New Features
------------------------------
* the attribute access macro `.` now accepts method calls.

1.0a3 (released 2021-07-09)
==============================

Expand Down
10 changes: 5 additions & 5 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ base names, such that ``hy.core.macros.foo`` can be called as just ``foo``.

::

(. foo bar baz [(+ 1 2)] frob)
(. foo (bar "qux") baz [(+ 1 2)] frob)

Compiles down to:

.. code-block:: python
foo.bar.baz[1 + 2].frob
foo.bar("qux").baz[1 + 2].frob
``.`` compiles its first argument (in the example, *foo*) as the object on
which to do the attribute dereference. It uses bare symbols as attributes
to access (in the example, *bar*, *baz*, *frob*), and compiles the contents
of lists (in the example, ``[(+ 1 2)]``) for indexation. Other arguments
raise a compilation error.
to access (in the example, *baz*, *frob*), Expressions as method calls (as in *bar*),
and compiles the contents of lists (in the example, ``[(+ 1 2)]``) for indexation.
Other arguments raise a compilation error.

Access to unknown attributes raises an :exc:`AttributeError`. Access to
unknown keys raises an :exc:`IndexError` (on lists and tuples) or a
Expand Down

0 comments on commit 8ed4424

Please sign in to comment.