Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
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
Jakub Stasiak
committed
Oct 17, 2016
1 parent
3766717
commit 25f2455d926a721ca6087f6ec2acfdc85d1e01aa
Showing
2 changed files
with
3 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters