1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
..
NOTE: This RST file was generated by `make examples`.
Do not edit it directly.
See docs/source/examples/example_doc_generator.py
.. _ex-composition:
Composition Example
===============================================================================
Demonstrate the use of Compostion of Atom objects.
1. If the class has not been declared, use a ForwardTyped
- Note the use of lambda, because "Person" is not yet defined
2. A Typed object can be instantiated three ways:
- Provide args, kwargs, or a factory in the definition
- Provide a _default_* static constructor
- Provide a pre-created object in the constructor
.. TIP:: To see this example in action, download it from
:download:`composition <../../../examples/api/composition.py>`
and run::
$ python composition.py
Example Atom Code
-------------------------------------------------------------------------------
.. literalinclude:: ../../../examples/api/composition.py
:language: python
|