News for hackers. Stuff that matters.
Re:Glom – Restructured Data for Python by mhashemi on Wednesday May 09, 2018 @04:32PM (#17033763)
The real advantage over toolz/get_in is in the breadth of types glom can support (http://glom.readthedocs.io/en/latest/api.html#setup-and-regi...), the extensive fallback behavior (http://glom.readthedocs.io/en/latest/api.html#advanced-speci...), and "T" specifier (https://sedimental.org/glom_restructured_data.html#true-pyth...), which allows performing object-oriented traversals and calls.

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... )

Re:Glom – Restructured Data for Python by nerdponx on Thursday May 10, 2018 @08:45AM (#17038324)
Sorry to double reply, but yes the "T" spec is exactly what I would want. IMO it's yet another step better than using a "spec" made of untyped nested lists and dicts.

DSL in strings = bad

DSL in native syntax = good

Re:Glom – Restructured Data for Python by nerdponx on Wednesday May 09, 2018 @09:50PM (#17035865)
Sentinel is one of my favorite objects in Python.
Re:Glom – Restructured Data for Python by Sean1708 on Thursday May 10, 2018 @06:20AM (#17037622)
What's the advantage of make_sentinel vs just doing _MISSING = object()?
Re:Glom – Restructured Data for Python by nerdponx on Thursday May 10, 2018 @08:41AM (#17038289)
A Sentinel is guaranteed unique and distinct from all other objects.
Re:Glom – Restructured Data for Python by Sean1708 on Thursday May 10, 2018 @09:55AM (#17038860)
I'm fairly sure object() also returns an object which is unique and distinct from all other objects. The only difference as far as I can see is that make_sentinel returns an object that has a unique and distinct type from all other objects, but I don't see why you'd be checking the type of your sentinels in Python.
Re:Glom – Restructured Data for Python by mhashemi on Thursday May 10, 2018 @06:40PM (#17043540)
Hehe, boltons.typeutils.make_sentinel should really be documented better for more experienced developers. A few small advantages: a nice repr, pickleability, and (back to the first advantage really) good rendering in a Sphinx autodoc context. :)
Re:Glom – Restructured Data for Python by doublereedkurt on Thursday May 10, 2018 @10:12AM (#17038973)
a nice __repr__ is the main thing