On Fri, Dec 1, 2017 at 6:16 AM, Paul Moore <[email protected]> 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:

https://docs.pylonsproject.org/projects/colander/en/latest/

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.

-CHB

-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[email protected]
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to