Skip to content

Commit

Permalink
Remove the docstring of hy.compiler.hy_eval
Browse files Browse the repository at this point in the history
It's not quite correct. It may've been once, but it hasn't been for a while (e.g., `read-str` is long gone). Time that might be spent on making sure the description is correct would be better spent on cleaning up the implementation. The larger issue is that we already have a lot of undermaintained user documentation; purely internal documentation is an additional maintenance burden.
  • Loading branch information
Kodiologist committed Aug 8, 2023
1 parent 2d6d5c5 commit deea080
Showing 1 changed file with 0 additions and 53 deletions.
53 changes: 0 additions & 53 deletions hy/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,59 +694,6 @@ def hy_eval(
import_stdlib=True,
globals=None,
):
"""Evaluates a quoted expression and returns the value.
If you're evaluating hand-crafted AST trees, make sure the line numbers
are set properly. Try `fix_missing_locations` and related functions in the
Python `ast` library.
Examples:
::
=> (hy.eval '(print "Hello World"))
"Hello World"
If you want to evaluate a string, use ``read-str`` to convert it to a
form first::
=> (hy.eval (hy.read-str "(+ 1 1)"))
2
Args:
hytree (Object):
The Hy AST object to evaluate.
locals (Optional[dict]):
Local environment in which to evaluate the Hy tree. Defaults to the
calling frame.
module (Optional[Union[str, types.ModuleType]]):
Module, or name of the module, to which the Hy tree is assigned and
the global values are taken.
The module associated with `compiler` takes priority over this value.
When neither `module` nor `compiler` is specified, the calling frame's
module is used.
compiler (Optional[HyASTCompiler]):
An existing Hy compiler to use for compilation. Also serves as
the `module` value when given.
filename (Optional[str]):
The filename corresponding to the source for `tree`. This will be
overridden by the `filename` field of `tree`, if any; otherwise, it
defaults to "<string>". When `compiler` is given, its `filename` field
value is always used.
source (Optional[str]):
A string containing the source code for `tree`. This will be
overridden by the `source` field of `tree`, if any; otherwise,
if `None`, an attempt will be made to obtain it from the module given by
`module`. When `compiler` is given, its `source` field value is always
used.
Returns:
Any: Result of evaluating the Hy compiled tree.
"""

module = get_compiler_module(module, compiler, True)

Expand Down

0 comments on commit deea080

Please sign in to comment.