Skip to content

Commit

Permalink
minor doc edits
Browse files Browse the repository at this point in the history
  • Loading branch information
craigbarratt committed Oct 21, 2023
1 parent 13354a8 commit 04bd867
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@ occurs.
``task.cancel(task_id=None)``
Cancels (kills) the task specified by the ``task_id`` returned by ``task.create``. This is a
simpler alternative to the ``task_id.cancel()`` method, which also requires waiting for the
task to cancel. With no argument, `task.cancel` cancels the current task, which you might prefer
task to cancel. With no argument, ``task.cancel`` cancels the current task, which you might prefer
to use in a trigger function on error, instead of a `return` or raising an exception.

``task.current_task()``
Expand Down Expand Up @@ -2025,7 +2025,7 @@ Here are some areas where pyscript differs from real Python:
be declared ``async``. Unless the Python module is designed to support async callbacks, it is not
currently possible to have Python modules and packages call pyscript functions. The workaround is
to move your callbacks from pyscript and make them native Python functions; see `Importing <#importing>`__.
- Continuing that point, special methods (eg, `__eq__`) in a class created in `pyscript` will not work since
- Continuing that point, special methods (eg, ``__eq__``) in a class created in `pyscript` will not work since
they are async functions and Python will not be able to call them. The two workarounds are to
use the ``@pyscript_compile`` decorator so the method is compiled to a native (non-ascync) Python
function, or write your class in native Python and import it into ``pyscript``; see `Importing <#importing>`__.
Expand All @@ -2044,6 +2044,7 @@ Here are some areas where pyscript differs from real Python:
A handful of language features are not supported:

- generators and the ``yield`` statement; these are difficult to implement in an interpreter.
- the ``match-case`` statement is not supported.
- built-in functions that do I/O, such as ``open``, ``read`` and ``write`` are not supported to avoid
I/O in the main event loop, and also to avoid security issues if people share pyscripts. The ``print``
function only logs a message, rather than implements the real ``print`` features, such as specifying
Expand All @@ -2055,3 +2056,5 @@ A handful of language features are not supported:
Pyscript can call Python modules and packages, so you can always write your own native Python code
(eg, if you need a generator or other unsupported feature) that can be called by pyscript
(see `Importing <#importing>`__ for how to create and import native Python modules in pyscript).
You can also include native Python functions in your pyscript code by using the ``@pyscript_compile``
decorator.

0 comments on commit 04bd867

Please sign in to comment.