Many docs updates.
parent
8ba5fbf27f
commit
63ee222406
@ -1,2 +1,28 @@
|
|||||||
|
"""
|
||||||
|
On the econtext master, this is imported from ``econtext/__init__.py`` as would
|
||||||
|
be expected. On the slave, it is built dynamically during startup.
|
||||||
|
|
||||||
|
As a convenience, the econtext package exports all of the functions and
|
||||||
|
variables from :py:mod:`econtext.core`.
|
||||||
|
"""
|
||||||
|
|
||||||
|
#: This is ``True`` in slave contexts. It is used in single-file Python
|
||||||
|
#: programs to avoid reexecuting the program's :py:func:`main` function in the
|
||||||
|
#: slave. For example:
|
||||||
|
#:
|
||||||
|
#: .. code-block:: python
|
||||||
|
#:
|
||||||
|
#: def do_work():
|
||||||
|
#: os.system('hostname')
|
||||||
|
#:
|
||||||
|
#: def main(broker):
|
||||||
|
#: context = broker.get_local()
|
||||||
|
#: context.call(do_work) # Causes slave to import __main__.
|
||||||
|
#:
|
||||||
|
#: if __name__ == '__main__' and not econtext.slave:
|
||||||
|
#: import econtext.utils
|
||||||
|
#: econtext.utils.run_with_broker(main)
|
||||||
|
#:
|
||||||
slave = False
|
slave = False
|
||||||
|
|
||||||
from econtext.core import * # NOQA
|
from econtext.core import * # NOQA
|
||||||
|
|||||||
Loading…
Reference in New Issue