[Python-ideas] Implementing a set of operation (+, /, - *) on dict consistent with linearAlgebrae

julien tayon julien at tayon.net
Tue Oct 30 11:31:12 EDT 2018


Hello :)

the idea is described here:http://jul.github.io/cv/pres.html#printable

Summary of the idea :

Take a linear algebrae book, and implements all the rules as a
TDD.https://github.com/jul/archery/blob/master/consistent_algebrae.py

make it works based on abstract base class and sets of
Mixins.https://archery.readthedocs.io/en/latest/

And see if we can make cos/__abs__/dot and if it gives naively the intended
results ? (spoiler: yes)

Making it work with dict, and "other" dictionary like counter by using
ineritancehttps://archery.readthedocs.io/en/latest/#advanced-usage

My idea is : wouldn't it be nice if we introduced geometries as sets of
mixins for objects ?
(Hilbertian algebrae could be nice too, and we could make MutableMapping
behave like bra/kets).

So I was proposing a soft discussion on : could we agree that it would be
nice to consider operation overloading as a whole set of behaviours that
could profit from being consistent in a categorized way ? (like the + of []
could be the + of "RecordAlgebrae")
Meaning we could define sets of "expected behaviour consistent interaction
between operators" as we defined the abc and call them algebrae?

I offer the LinearAlgebrae Mixins as a POC, and was thinking of creating a
unittest to qualify if an object is following the rules of linear algebrae.

What are your opinions ?
I don't actually see a lot of use case except it was funny to build. But
maybe it can be of use.


Cordialement

-- 
Julien
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20181030/d39d1a0f/attachment.html>


More information about the Python-ideas mailing list