diff --git a/docs/introduction/what_is_di.rst b/docs/introduction/what_is_di.rst index fb9caa62..82392029 100644 --- a/docs/introduction/what_is_di.rst +++ b/docs/introduction/what_is_di.rst @@ -83,14 +83,12 @@ Let's go through the code of ``example.py``: .. literalinclude:: ../../examples/di_demo/example.py :language: python - :linenos: -At some point, things defined above mean, that the code from ``example.py``, +At some point, things defined above mean, that the code from ``example.py``, could look different, like in ``example_di.py``: .. literalinclude:: ../../examples/di_demo/example_di.py :language: python - :linenos: Best explanation, ever ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/examples/di_demo/example.py b/examples/di_demo/example.py index 4aaa9590..8f4a4234 100644 --- a/examples/di_demo/example.py +++ b/examples/di_demo/example.py @@ -2,16 +2,16 @@ class Service: - """Some "Service".""" + """The Service.""" class Client: - """Some "Client" that uses "Service".""" + """The Client that uses the Service.""" def __init__(self): - """Initialize instance.""" - self.service = Service() # Service instance is created inside Client + """Initialize the Client.""" + self.service = Service() # The Service is created by the Client if __name__ == '__main__': - client = Client() # Application creates Client's instance + client = Client() # Application creates the Client diff --git a/examples/di_demo/example_di.py b/examples/di_demo/example_di.py index cd19c591..ddbbe14b 100644 --- a/examples/di_demo/example_di.py +++ b/examples/di_demo/example_di.py @@ -1,18 +1,18 @@ -"""The Code, that demonstrates dependency injection pattern.""" +"""The Code that demonstrates dependency injection pattern.""" class Service: - """Some "Service".""" + """The Service.""" class Client: - """Some "Client" that uses "Service".""" + """The Client that uses the Service.""" - def __init__(self, service): # Service instance is injected into Client - """Initialize instance.""" + def __init__(self, service): # The Service is injected into the Client + """Initialize the Client.""" self.service = service if __name__ == '__main__': - service = Service() # Application creates Service instance - client = Client(service) # and inject Service instance into the Client + service = Service() # Application creates the Service + client = Client(service) # and inject the Service into the Client