Skip to content

Commit e512bd4

Browse files
authored
docstring edits
1 parent fdbc66d commit e512bd4

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

src/PyMacro/PyMacro.jl

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -860,35 +860,31 @@ end
860860
"""
861861
@py expr
862862
863-
Evaluate `expr` using Python syntax and semantics while staying in Julia.
864-
The macro lowers the provided Julia syntax tree to calls into PythonCall's
865-
runtime (for example, `pycall`, `pyadd`, `pygetattr`, and friends) and returns
866-
the resulting `Py` object.
863+
Evaluate `expr` using Python-like syntax and semantics and return the
864+
resulting [`Py`](@ref) object.
867865
868866
Supported syntax includes:
869867
870-
* **Literals and names** – Numeric and string literals, `None`, `True`, `False`,
871-
container displays (`(…)`, `[…]`, `{…}`, `{key:value, …}`) and special
868+
* **Literals and names:** Numeric and string literals, `None`, `True`, `False`,
869+
containers (`(…)`, `[…]`, `{…}`, `{key:value, …}`) and special
872870
placeholders such as `__file__` and `__line__`.
873-
* **Calls and operators** – Function calls are translated to `pycall`, unary
871+
* **Calls and operators:** Function calls are translated to `pycall`, unary
874872
and binary operators are forwarded to the corresponding `py*` helper
875873
(e.g. `x + y` → `pyadd(x, y)`, `x === y` → `pyis(x, y)`), and chained
876874
arithmetic or comparison expressions behave like their Python equivalents.
877-
* **Attribute access and indexing** – `obj.attr`, `obj[key]`, and slice syntax
875+
* **Attribute access and indexing:** `obj.attr`, `obj[key]`, and slice syntax
878876
(`obj[start:stop:step]`) map to `pygetattr`, `pygetitem`, and `pyslice`.
879-
* **Statements inside blocks** – Within `@py begin … end` you can perform
880-
assignments, `@del` deletions, `if`/`elif`/`else`, `while`, and `for`
881-
statements, and short-circuit boolean logic (`&&`/`||`). Import statements
882-
(`import pkg`, `import pkg as alias`, `from pkg import name as alias`) are
877+
* **Statements:** Assignments, `@del` deletions, `if`/`elseif`/`else`, `while`, `for`,
878+
short-circuit boolean logic (`&&`/`||`). Import statements
879+
(`import pkg`, `import pkg as alias`, `import pkg: attr as alias`) are
883880
also supported.
884-
* **Interop helpers** – Use `@jl expr` to splice the result of a Julia
881+
* **Interop helpers:** Use `@jl expr` to splice the result of a Julia
885882
expression into the Python evaluation. The auxiliary macros `@compile`,
886-
`@eval`, and `@exec` wrap `pybuiltins.compile` to provide the same behaviour
887-
as their Python counterparts.
883+
`@eval`, and `@exec` work like `compile`/`eval`/`exec` in Python but compile
884+
the code argument once and reuse it for speed.
888885
889-
Names that match Python builtins are resolved through `pybuiltins`; other
890-
identifiers are captured from the surrounding Julia scope. Convert the result
891-
to Julia values with `pyconvert` or related helpers if desired.
886+
Names that match Python builtins are resolved through [`pybuiltins`](@ref); other
887+
identifiers are captured from the surrounding Julia scope.
892888
893889
# Examples
894890

0 commit comments

Comments
 (0)