Added documentation about import

This commit is contained in:
Clinton N. Dreisbach 2013-05-08 22:16:03 -04:00
parent 1fa53f9255
commit d76d011b11

View File

@ -38,6 +38,36 @@ Hy features a number special forms that are used to help generate
correct Python AST. The following are "special" forms, which may have
behavior that's slightly unexpected in some situations.
import
------
`import` is used to import modules, like in Python. There are several forms
of import you can use.
.. code-block:: clj
;; Imports each of these modules
;;
;; Python:
;; import sys
;; import os.path
(import sys os.path)
;; Import from a module
;;
;; Python: from os.path import exists, isdir, isfile
(import [os.path [exists isdir isfile]])
;; Import with an alias
;;
;; Python: import sys as systest
(import [sys :as systest])
;; You can list as many imports as you like of different types.
(import [tests.resources [kwtest function-with-a-dash]]
[os.path [exists isdir isfile]]
[sys :as systest])
do / progn
----------