Closed
Description
I often use multi-binding where I want to use DI to create instances of the sequence -- hence I can't bind instances directly to the sequence key. My workaround is the utility class below, but it feels like this should be built into the framework (esp. since ListOfProviders is markes @Private)
binder.multibind(Test.SEQ_KEY, ClassProviderList([MyClass])) # Not an instance.
class ClassProviderList(ListOfProviders):
def __init__(self, classes):
super(ClassProviderList, self).__init__()
for cls in classes:
self.append(ClassProvider(cls))
Metadata
Metadata
Assignees
Labels
No labels