tobgu / pyrsistent

Persistent/Immutable/Functional data structures for Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Access to a nested element from a "Path"

yellowbean opened this issue · comments

There is a Path-alike : ['articles', ny, 'content'] in the transform function.

very_short_news = news_paper.transform(['articles', ny, 'content'], lambda c: c[:15] + '...' if len(c) > 15 else c)

Could we have something Path-alike to Query elements

news_paper.query(['articles', ny, 'author']) == ['Sara', 'Steve']

the list can be easily built and compose to other type of path points to elements of interest