best-doctor / Mario

Shaping your business logic in Python
MIT License
17 stars 2 forks source link

Return result dict, not result value #20

Closed mcproger closed 4 years ago

mcproger commented 4 years ago

Right now, method SomePipeline.run returns the first value from the dict, which is the result of the last pipe. How about returning the full dict?

For example:

class Pipeline(BasePipeline):
    def make_some():
        return {'test1': 100500, 'test2': 200500}

Now, when I call Pipeline().run() it returns only 100500. But I want to get {'test1': 100500, 'test2': 200500}

mcproger commented 4 years ago

@Melevir

Melevir commented 4 years ago

Not sure.

This approach can lead to god-pipeline, that does everything with all items and returns all you need.

On the other side, current API can be too strict.

mcproger commented 4 years ago

This approach can lead to god-pipeline, that does everything with all items and returns all you need.

True. Actually, I can fix my problem with nested dict, like

return {'result': {'test1': 100500, 'test2': 200500}}

Unfortunately, it also can lead to god-pipeline. I will think what we can do to resolve it.