Fix an example in interop.rst
This commit is contained in:
parent
c4f73f061f
commit
70747a58c3
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user