Skip to content

Confused by specificity injector #2

@garyrob

Description

@garyrob

First I want to say that I'm new to dependency injection in general, but in the last week have experimented with the dependency-injector library, which seemed much more cumbersome to use than the injector library (which I also tried), which in turn seems much more cumbersome to use than autocontainer. So at this point I have to say that I'm very impressed with autocontainer and look forward to trying to use it in an upcoming project where I think dependency injection could be very helpful.

But, I'm confused by the Specifity Injector functionality described in an example on your main page. In the example, class D inherits from class A; class A does not inherit from class D. But the object retrieved with container.get(A) apparently inherits from both A and D, based on the results of the isinstance() asserts. This doesn't make sense to me. Why is that happening? Why would I even want it to happen?

It seems like it could be a good idea for the documentation to explain this.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions