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
Sentinel is one of my favorite objects in Python.
What's the advantage of make_sentinel vs just doing _MISSING = object()?
A Sentinel is guaranteed unique and distinct from all other objects.
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.
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
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... )