Please sign in to comment.
Stop supporting decorating classes with @Inject
It is a future of limited use (just a convenience) but it can confuse some people (it's not immediately clear how @inject-decorated class' constructors behave and what's the relationship between Injector and constructors). Additionally it doesn't cooperate nicely with static analysis tools like mypy, for example: @Inject(s=SomeOtherClass) class C: pass No tool knows there's an attribute all C instances have and that its type is SomeOtherClass. They'll know in this case: class C: @Inject(s=SomeOtherClass) def __init__(self, s: SomeOtherClass) -> None: self.s = s Granted, there's repetition but an Injector change will land soon to address this.
- Loading branch information
Showing with 3 additions and 137 deletions.