-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about how rodi handles __init__ #43
Comments
Hi @lucas-labs As a side note, all inspections happen once for best performance: rodi creates activator functions that are used to resolve objects. But now that you are asking about this, rodi might be modified to support both cases: resolving both I wouldn't care about the activists you mention: I also prefer to not define an |
@RobertoPrevato Yeah! I've worked with The only useful situation that I can think of supporting both, having an class Baz:
foo: Foo
def __init__(self) -> None:
self.whatever = ':)'
def call_foo(self) -> str:
return self.foo.bar() In this case Thanks for the answer!! |
Hi!
I was working on a project using rodi and I noticed that when a dependency that depends on another dependency has an
__init__
, it fails to resolve. Ok, I'm not good explaing things with human words, so as Linus said... talk is cheap, show me the code:This works just fine:
But if we add a init, it gets angry
And this works too, but I love the idea of not having to use an
__init__
if I don't need it (I know there's a whole activist movement out there claiming that constructor based injection is the new heaven. But I prefer property-based injection if that option is available, especially in python):So, here's my question. Is this behaviour by design?
The text was updated successfully, but these errors were encountered: