Merge pull request #1715 from Kodiologist/interop-docs

Fix an example in interop.rst
This commit is contained in:
Kodi Arfer 2019-01-12 12:06:49 -05:00 committed by GitHub
commit a42e17a025
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,8 +47,8 @@ If you save the following in ``greetings.hy``:
.. code-block:: clj .. code-block:: clj
(setv *this-will-be-in-caps-and-underscores* "See?") (setv this-will-have-underscores "See?")
(defn greet [name] (print "hello from hy," name)) (defn greet [name] (print "Hello from Hy," name))
Then you can use it directly from Python, by importing Hy before importing Then you can use it directly from Python, by importing Hy before importing
the module. In Python:: the module. In Python::
@ -56,8 +56,8 @@ the module. In Python::
import hy import hy
import greetings import greetings
greetings.greet("Foo") # prints "Hello from hy, Foo" greetings.greet("Foo") # prints "Hello from Hy, Foo"
print(THIS_WILL_BE_IN_CAPS_AND_UNDERSCORES) # prints "See?" print(greetings.this_will_have_underscores) # prints "See?"
If you create a package with Hy code, and you do the ``import hy`` in If you create a package with Hy code, and you do the ``import hy`` in
``__init__.py``, you can then directly include the package. Of course, Hy still ``__init__.py``, you can then directly include the package. Of course, Hy still