Closed Evgenus closed 7 years ago
Can you write how you'd like it to work? Code example would be best.
On Dec 17, 2016 20:03, "Eugene Chernyshov" notifications@github.com wrote:
Any plans to support?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/adriank/ObjectPath/issues/50, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKyconNgH-PNswhh7SsJZQfhE5-CYY8ks5rJDIKgaJpZM4LP9PR .
$.attr - matches object attribute
$[attr] - matches dictionary key
$.* - matches any attribute
$.** - same recursively
$[*] - matches any dictionary key
$[**] - same recursively
attribute matching should be implemented via hasattr
/getattr
dictionary key matching should work for any object that implements collections.abc.Mapping
>>> import datetime
>>> import objectpath
>>> objectpath.Tree(datetime).execute("$.*.now") # searches something with `now`
<built-in method now of type object>
Maybe that would require alternative implementation at general..
@adriank, any answer? Tell me something please. Like "won't fix" or "not in my project" or whatever you decide.
@Evgenus Sorry for the late response.
The purpose of ObjectPath is to simplify work with huge nested structures, mainly JSON, retrieved from some APIs or from databases such as MongoDB. Descent and recursive descent operators are very basic features of the language. You can implement functions to extract information from Python objects within a few hours.
I believe there isn't a strong case for including them in ObjectPath as it wouldn't serve the community who uses ObjectPath as a tool for speeding up their data mining exercises.
Any plans to support? I would like to