adriangb / di

Pythonic dependency injection
https://www.adriangb.com/di/
MIT License
301 stars 13 forks source link

feat: more flexible binds #49

Closed adriangb closed 2 years ago

adriangb commented 2 years ago

It might be nice to have more flexible binds, for example the option to:

This would probably require having a protocol like:

class BindMatcher(Protocol):
    def match(self, param: inspect.Parameter) -> Optional[DependantBase]:
        ...

The risk is that this increases complexity for non-existent use cases. This will probably not get implemented until it is requested by users.

adriangb commented 2 years ago

Implemented!