Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 983 Bytes

ex_composition.rst

File metadata and controls

30 lines (22 loc) · 983 Bytes

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 composition <../../../examples/api/composition.py> and run:

$ python composition.py

Example Atom Code

../../../examples/api/composition.py