Misc interesting questions

What is addition in MutableMapping useful for?

It is used with parseweblog as an exemple. I find addition on MutableMapping a very convenient way to reduce by using in place addition (__iadd__).

VectorDict also has an exemple of map/reduce with multiprocessing word counting

MapReduce is a way of treating big data without consuming too much memory ensuring relativley good performance. It is normaly considered to belong to the functional paradigm and is best used with generators.

Doesn’t it overlaps with defaultdict?

No. Results seems similar, but the collections.defaultdict philosophy is different and does not mix in very well with archery because you have a conflict. I therefore admit, there is a design flaw in VectorDict.

defaultdict creates missing key from a factory (a function with void argument) and will consider that asking for a key that does not exists makes it real.

MutableMapping with the default traits will raise an Exception in such case, however, if you add to MutableMapping, as the default Adder is Inclusive, it will add the exisiting key of the source and destination. No values in MutableMapping with the default Adder will exists unless there are already defined in the MutableMappings.

Since traits are flexible, You or I could provide more stricts dict.

Trait seems to provide autovivification but it does not ! No values will be created on the fly.

As a result, there is a conflict between defaultdict and traits : for instance with a defaultdict when you add with a value that does not exists in one of the dict you should use the default factory. With actual traits, it is assumed the value is the neutral element of addition, thus having far less problems than with defaultdict.

Why so much fuss on Algebrae if you use Addition 99% of the time?

Because Algebrae is not about knowing the value of 1 + 1, it is about consistency rules for operator. People usually focus on the operand of an operation to check if it works, I focus on the operator behaviour and how well they behave together. Mathematical symbols are a litterature whose intuition can safely work if we stay in the safeguard of the acceptable behaviour. These behaviours are commonly refered: distributivity, neutral element, scalar multiplication (or linear combinations), associativity.

Algebrae, is as a result for me only a functional test for the macro behaviour of addition. Addition alone has strictly no sense.

What is your naming convention, and what is archery exactly?

It is all explained her : http://beauty-of-imagination.blogspot.com/2012/05/joice-and-headache-of-naming.html

Who needs archery?

  • people wanting to experiment what a good addition on any MutableMapping (dict included) coud be (trait documentation is for them);
  • people wanting to have a consistent set of operations for their MutableMapping (quiver is for them);
  • those who wants ready made dict pretty practical for map/reduce (bow is for them).