Skip to content

Commit 7e6e264

Browse files
committed
Use shorter idiomatic python for README examples (pacifica#24)
1 parent d90f87c commit 7e6e264

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ The `jsonpath2.path.Path` class represents a JSONPath.
1818
>>> from jsonpath2.path import Path
1919
>>> p = Path.parse_str('$["hello"]')
2020
<jsonpath2.path.Path object>
21-
>>> list(map(lambda match_data: match_data.current_value, p.match(d)))
21+
>>> [match_data.current_value for match_data in p.match(d)]
2222
['Hello, world!']
23-
>>> list(map(lambda match_data: match_data.node.tojsonpath(), p.match(d)))
23+
>>> [match_data.node.tojsonpath() for match_data in p.match(d)]
2424
['$["hello"]']
2525
```
2626

@@ -130,9 +130,9 @@ The syntax for a function call is the name of the function followed by the argum
130130
>>> from jsonpath2.path import Path
131131
>>> p = Path.parse_str('$["hello"][length()]')
132132
<jsonpath2.path.Path object>
133-
>>> list(map(lambda match_data: match_data.current_value, p.match(d)))
133+
>>> [m.current_value for m in p.match(d)]
134134
[13]
135-
>>> list(map(lambda match_data: match_data.node.tojsonpath(), p.match(d)))
135+
>>> [m.node.tojsonpath() for m in p.match(d)]
136136
['$["hello"][length()]']
137137
```
138138

0 commit comments

Comments
 (0)