by radmin · 8y ago · 0 comments
Here's a example comparison:
glom
glom(target, ('system.planets', ['name']))
# ['earth', 'jupiter']
toolz list(pluck('name', get_in(('system', 'planets'), target)))
# ['earth', 'jupiter']Check the post for more examples of where path-based access falls short of the mark!
(Sidenote: I find it very clunky that get_in() takes a "default" kwarg and _also_ a n"o_default" kwarg. Use a Sentinel object! http://boltons.readthedocs.io/en/latest/typeutils.html#bolto... )
DSL in strings = bad
DSL in native syntax = good