Skip to content

Commit 93a02c2

Browse files
Update dependency-inversion.md
1 parent a576e37 commit 93a02c2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

rodi/docs/dependency-inversion.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ container.add_transient_by_factory(my_factory) # <-- MyClass is used as Key.
234234

235235
## Working with generics
236236

237-
Generic types are supported. The following example provides a meaningful
238-
demonstration of generics with `TypeVar` in a real-world scenario.
237+
Generic types are supported. The following example provides a demonstration of
238+
generics with `TypeVar` in a real-world scenario.
239239

240240
```python {linenums="1", hl_lines="9 43-44 47-48"}
241241
from dataclasses import dataclass
@@ -246,7 +246,7 @@ from rodi import Container
246246
T = TypeVar("T")
247247

248248

249-
class Repository(Generic[T]): # interface
249+
class Repository(Generic[T]):
250250
"""A generic repository for managing entities of type T."""
251251

252252
def __init__(self):
@@ -309,8 +309,9 @@ The above prints to screen:
309309
type: warning
310310

311311
Note how the generics `Repository[Product]` and `Repository[Customer]` are both
312-
configured to be resolved using `Repository` as concrete type. `GenericAlias`
313-
in Python is not considered an actual class. The following wouldn't work:
312+
configured to be resolved using `Repository` as concrete type. Instances of
313+
`GenericAlias` are not considered as actual classes. The following wouldn't
314+
work:
314315

315316
```python
316317
container.add_scoped(Repository[Product]) # No. 💥

0 commit comments

Comments
 (0)