This is the key point. When I was working on this PEP, it was very much about None, and traversal of unvalidated[1] objects was just something that gets a bit nicer with get().
I’m sure most people are aware, but I was turned to -1 on the entire proposal, and remain there ![]()
For traversal tasks, I now prefer some kind of metalanguage - glom is a great example, and if I could ever remember the syntax for more than five minutes at a time I’d probably like XPath too. A traversal helper - possibly aligned with match statements? - would be a welcome addition.
For None handling, my code now relies more heavily on preventing None at the boundaries. So my code is usually going to raise rather than return None, and it’s going to replace or exclude incoming None (often with a no-op object instance that matches all the others - e.g. a None in a list of file objects gets replaced with open(os.devnull)).
I’d still probably use ?? if it were added (for None), just for the slight improvement over using or. But I think ?., ?[ and ?([2] are best avoided entirely.
In the sense that we haven’t already checked the entire schema. This is a less common scenario now, as tools like Pydantic make it easier to be pedantic about the object before you even start traversing it. ↩︎
All of which have been used incorrectly in multiple examples in this thread already… that’s a bit of a warning sign. ↩︎