[Python-ideas] PEP 505 vs matrix multiplication

Chris Barker chris.barker at noaa.gov
Fri Dec 1 12:40:51 EST 2017


On Fri, Dec 1, 2017 at 6:16 AM, Paul Moore <p.f.moore at gmail.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:

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

Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20171201/d1c948e2/attachment.html>


More information about the Python-ideas mailing list