mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-02-14 18:40:52 +03:00
Update DI in Python page
This commit is contained in:
parent
6aee30ea15
commit
0a81d19b72
|
@ -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
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
|
|
@ -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.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user