File: ex_default_value.rst

package info (click to toggle)
python-atom 0.12.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,616 kB
  • sloc: cpp: 9,040; python: 6,249; makefile: 123
file content (28 lines) | stat: -rw-r--r-- 867 bytes parent folder | download
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
..
  NOTE: This RST file was generated by `make examples`.
  Do not edit it directly.
  See docs/source/examples/example_doc_generator.py

.. _ex-default_value:

Default Value Example
===============================================================================

 Demonstrate all the ways to initialize a value

1. Pass the value directly
2. Assign the default value explicitly
3. Provide the value during initialization of the object
4. Provide factory callable that returns a value
5. Use a _default_* static method

.. TIP:: To see this example in action, download it from
 :download:`default_value <../../../examples/api/default_value.py>`
 and run::

   $ python default_value.py

Example Atom Code
-------------------------------------------------------------------------------
.. literalinclude:: ../../../examples/api/default_value.py
    :language: python