h2non / jsonpath-ng

Finally, a JSONPath implementation for Python that aims to be standard compliant. That's all. Enjoy!
Apache License 2.0
606 stars 88 forks source link

Why `update` method both modifies data and returns it? #10

Closed petar-donchev closed 1 year ago

petar-donchev commented 6 years ago

Wouldn't it be better if there are two methods in public API, one that modifies its argument and returns nothing, and one that does not modify it and returns a modified copy? Or just have one of these.

michaelmior commented 1 year ago

Having the method work like this means you can do some easier chaining in some cases. Both of the use cases you present are still possible. However, if you have a concrete proposal for improving the API, feel free to submit a pull request.