mirror of
				https://github.com/ets-labs/python-dependency-injector.git
				synced 2025-11-04 01:47:36 +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
 | 
			
		||||
   :language: python
 | 
			
		||||
   :linenos:
 | 
			
		||||
 | 
			
		||||
Listing of ``example.cars`` module:
 | 
			
		||||
 | 
			
		||||
.. literalinclude:: ../../examples/miniapps/engines_cars/example/cars.py
 | 
			
		||||
   :language: python
 | 
			
		||||
   :linenos:
 | 
			
		||||
 | 
			
		||||
Next example demonstrates creation of several cars with different engines:
 | 
			
		||||
 | 
			
		||||
.. literalinclude:: ../../examples/miniapps/engines_cars/example_di.py
 | 
			
		||||
   :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 
 | 
			
		||||
code for specification of dependencies. Nevertheless, this disadvantage could 
 | 
			
		||||
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
 | 
			
		||||
   :language: python
 | 
			
		||||
   :linenos:
 | 
			
		||||
 | 
			
		||||
Useful links
 | 
			
		||||
~~~~~~~~~~~~
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,8 +4,8 @@
 | 
			
		|||
class Engine:
 | 
			
		||||
    """Example engine base class.
 | 
			
		||||
 | 
			
		||||
    Engine is a heart of every car. Engine is a very common term and could be
 | 
			
		||||
    implemented in very different ways.
 | 
			
		||||
    Engine is a heart of every car. Engine is a very common term and
 | 
			
		||||
    could be implemented in very different ways.
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user