On Fri, Dec 1, 2017 at 6:16 AM, Paul Moore email@example.com wrote:
I genuinely don't think these kinds of operators are all that useful outside the specific domain of working with semi-structured hierarchical data stored in graph databases and document stores like MongoDB, ElasticSearch, and PostgreSQL JSONB columns, or else piping data between such stores and JSON consuming clients.
In that case, surely there are 3rd party libraries that help with extracting such data from raw objects?
Sure -- it's handled by validation libraries like Colander, for instance:
And I'd be shocked if there weren't similar functionality built in to PyMongo and such.
Which makes a lot of sense -- if you want to enforce any kind of schema, you need to specify which fields are optional, and handle those cases.
So this is perhaps largely about making it easier to write such libraries.
Though the other really common use case is None default parameters:
def fun(self, par1, par2, par3=None): if par3 is None: self.par3 = something_mutable
is a really common idiom -- though not all the verbose.