DEV Community

Discussion on: Masonite Lessons - Using The Factory Pattern

Collapse
 
rf_schubert profile image
Raphael Schubert

You can improve it a little!

    def make(self, service, *args, **kwargs):
        return self.services[service](*args, **kwargs)

Add

*args, **kwargs

to it and will allow pass vars to make.

Like

ServiceFactory().make('foo_bar', foo, bar)