Skip to content

Commit

Permalink
Merge pull request #2624 from Kodiologist/misc
Browse files Browse the repository at this point in the history
Miscellany
  • Loading branch information
Kodiologist authored Jan 8, 2025
2 parents 647b423 + 8b50ca5 commit 2d286a6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2024 the authors.
Copyright 2025 the authors.
Portions of setup.py, copyright 2016 Jason R Coombs <[email protected]>.

Permission is hereby granted, free of charge, to any person obtaining a
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# Ultimately this will only appear on the page itself. The actual HTML title
# will be simplified in post-processing.

hyrule_version = 'v0.7.0'
hyrule_version = 'v0.8.0'

source_suffix = '.rst'
master_doc = 'index'
Expand Down
19 changes: 11 additions & 8 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -244,19 +244,22 @@ Define classes with :hy:func:`defclass`::
(defn get-x [self]
self.x))

Here we create a new instance ``fb`` of ``FooBar`` and access its attributes by
various means::
Here we create a new instance ``fb`` of ``FooBar`` and access its attributes
with a :ref:`dotted identifier <dotted-identifiers>` or :ref:`the dot macro
<dot>`::

(setv fb (FooBar 15))
(print fb.x) ; => 15
(print (. fb x)) ; => 15
(print (.get-x fb)) ; => 15
(print (fb.get-x)) ; => 15
(print fb.x) ; => 15
(print (. fb x)) ; => 15
(print (. fb (get-x)) ; => 15
(print (.get-x fb)) ; => 15
(print (fb.get-x)) ; => 15

Note that syntax like ``fb.x`` and ``fb.get-x`` only works when the object
being invoked (``fb``, in this case) is a simple variable name. To get an
attribute or call a method of an arbitrary form ``FORM``, you must use the
syntax ``(. FORM x)`` or ``(.get-x FORM)``, or call :py:func:`getattr`.
attribute or call a method of an arbitrary form ``FORM``, you must use one of
the other options, such as ``(. FORM x)`` or ``(.get-x FORM)``, or call
:py:func:`getattr`.

Access an external module, whether written in Python or Hy, with
:hy:func:`import`::
Expand Down

0 comments on commit 2d286a6

Please sign in to comment.