Update DI in Python page

This commit is contained in:
Roman Mogylatov 2020-07-18 00:16:11 -04:00
parent 6aee30ea15
commit 0a81d19b72
2 changed files with 3 additions and 7 deletions

View File

@ -103,21 +103,18 @@ Listing of ``example.engines`` module:
.. literalinclude:: ../../examples/miniapps/engines_cars/example/engines.py .. literalinclude:: ../../examples/miniapps/engines_cars/example/engines.py
:language: python :language: python
:linenos:
Listing of ``example.cars`` module: Listing of ``example.cars`` module:
.. literalinclude:: ../../examples/miniapps/engines_cars/example/cars.py .. literalinclude:: ../../examples/miniapps/engines_cars/example/cars.py
:language: python :language: python
:linenos:
Next example demonstrates creation of several cars with different engines: Next example demonstrates creation of several cars with different engines:
.. literalinclude:: ../../examples/miniapps/engines_cars/example_di.py .. literalinclude:: ../../examples/miniapps/engines_cars/example_di.py
:language: python :language: python
:linenos:
While previous example demonstrates advantages of dependency injection, there While previous example demonstrates advantages of dependency injection, there
is a disadvantage demonstration as well - creation of car requires additional is a disadvantage demonstration as well - creation of car requires additional
code for specification of dependencies. Nevertheless, this disadvantage could code for specification of dependencies. Nevertheless, this disadvantage could
be easily avoided by using a dependency injection framework for creation of be easily avoided by using a dependency injection framework for creation of
@ -128,7 +125,6 @@ using :doc:`Dependency Injector <../index>`:
.. literalinclude:: ../../examples/miniapps/engines_cars/example_ioc_containers.py .. literalinclude:: ../../examples/miniapps/engines_cars/example_ioc_containers.py
:language: python :language: python
:linenos:
Useful links Useful links
~~~~~~~~~~~~ ~~~~~~~~~~~~

View File

@ -4,8 +4,8 @@
class Engine: class Engine:
"""Example engine base class. """Example engine base class.
Engine is a heart of every car. Engine is a very common term and could be Engine is a heart of every car. Engine is a very common term and
implemented in very different ways. could be implemented in very different ways.
""" """