Skip to content

Conversation

@dangra
Copy link
Contributor

@dangra dangra commented Jun 5, 2019

Description

This change improves readability of examples in README page.

Several sources suggests that List comprehensions are more idiomatic than map() or filter() builtins, even Pylint raises a warning when these builtins are used.

Issues Resolved

None, I was just passing by looking for a JsonPath implementation and the examples caught my attention.

Check List

  • All tests pass.
  • New functionality includes testing.
  • New functionality has been documented in the README if applicable

Copy link
Member

@dmlb2000 dmlb2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@dmlb2000 dmlb2000 merged commit ecee29d into pacifica:master Jun 9, 2019
@dangra dangra deleted the patch-1 branch June 9, 2019 20:59
dangra added a commit to dangra/python-jsonpath2 that referenced this pull request Jun 9, 2019
dangra added a commit to dangra/python-jsonpath2 that referenced this pull request Jun 9, 2019
dmlb2000 pushed a commit that referenced this pull request Jun 9, 2019
* Add handy shortcut to match string path

This change aims to avoid the boilerplate of applying a JsonPath to a document

```python
>>> import jsonpath2 as jsonpath
>>> doc = {'hello': 'Hello, world!'}
>>> [m.current_value for m in jsonpath.match('$["hello"]', doc)]
```

It resembles the use of `re` module in `re.match(pattern, string)` vs `re.compile(pattern).match(string)`

* Add test case for jsonpath2.match shortcut

* Use shorter idiomatic python for README examples (#24)

* Update README
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants