Tune readme
This commit is contained in:
parent
7e99690d25
commit
8162456ca2
12
README.md
12
README.md
|
@ -27,10 +27,10 @@ pip install injector
|
||||||
Supported Python versions
|
Supported Python versions
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
Injector work with the following Python interpreters:
|
Injector works with the following Python interpreters:
|
||||||
|
|
||||||
- CPython 2.6, 2.7, 3.2, 3.3
|
- CPython 2.6+, 3.2+
|
||||||
- PyPy 1.9
|
- PyPy 1.9+
|
||||||
|
|
||||||
Recent Notable Changes
|
Recent Notable Changes
|
||||||
----------------------
|
----------------------
|
||||||
|
@ -181,7 +181,9 @@ Terminology
|
||||||
|
|
||||||
At its heart, Injector is simply a dictionary for mapping types to things that create instances of those types. This could be as simple as:
|
At its heart, Injector is simply a dictionary for mapping types to things that create instances of those types. This could be as simple as:
|
||||||
|
|
||||||
|
```python
|
||||||
{str: 'an instance of a string'}
|
{str: 'an instance of a string'}
|
||||||
|
```
|
||||||
|
|
||||||
For those new to dependency-injection and/or Guice, though, some of the terminology used may not be obvious.
|
For those new to dependency-injection and/or Guice, though, some of the terminology used may not be obvious.
|
||||||
|
|
||||||
|
@ -203,8 +205,10 @@ A binding key uniquely identifies a provider of a type. It is effectively a tupl
|
||||||
|
|
||||||
For example, the following are all unique binding keys for `str`:
|
For example, the following are all unique binding keys for `str`:
|
||||||
|
|
||||||
|
```python
|
||||||
(str, 'name')
|
(str, 'name')
|
||||||
(str, 'description')
|
(str, 'description')
|
||||||
|
```
|
||||||
|
|
||||||
For a generic type such as `str`, annotations are very useful for unique identification.
|
For a generic type such as `str`, annotations are very useful for unique identification.
|
||||||
|
|
||||||
|
@ -220,8 +224,10 @@ As an *alternative* convenience to using annotations, `Key` may be used to creat
|
||||||
|
|
||||||
Which may then be used as binding keys, without annotations, as they already uniquely identify a particular provider:
|
Which may then be used as binding keys, without annotations, as they already uniquely identify a particular provider:
|
||||||
|
|
||||||
|
```python
|
||||||
(Name, None)
|
(Name, None)
|
||||||
(Description, None)
|
(Description, None)
|
||||||
|
```
|
||||||
|
|
||||||
Though of course, annotations may still be used with these types, like any other type.
|
Though of course, annotations may still be used with these types, like any other type.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue