On Sat, Dec 31, 2011 at 2:16 AM, julien tayon firstname.lastname@example.org wrote:
Dear All :)
2011/12/30 Eric Snow email@example.com:
On Fri, Dec 30, 2011 at 10:02 AM, Guido van Rossum firstname.lastname@example.org wrote:
What I meant is similar to set union on the keys, where if a key exists in both dicts, the value in the result is equal to one of the values in the operands (and if the value is the same for both operands, that value is also the result value).
This is the one I was thinking of too.
Well, since I have coded way too much in Perl, my altered sense of reality has come to a concept I may be introducing too early which is : algebrae.
strings, lists, ... have a record algebrae. ndarray, accudict have a linear algebrae sets ... have sets algebrae.
And much more algebrae exists wich all exists not only in my imagination, but also in math (wich I quite dislike). (Abelian stuff/Group/matrix/hilbert) All of these algebrae are consistent as long as any object in the chain of algebrae are following the same rules.
And each of these are very legitimate (even though of course my dict addition is the best without trying to be obnoxious).
I was kind of thinking of 1) giving a property to object called .. __algebrae__, 2) and through some magic being able to change the algebrae of an object on the fly.
My twisted sense of reality inherited from Perl (but a little less than my math books) tells me There Is More Than One Way To Consistently Add/Mul/Div/Sub It.
As a Proof of Concept I could deliver a monkeypatching of list() that makes it behave like an numpy array.
Please don't present this in terms of modifications of existing functions/types/methods. Please use subclasses, new modules, new functions, etc.
But, at first I wish to concentrate on dict addition, since I can only steal a few hours connectivity per day ... So I will try to answer to everyone since I saw some spoilers of what I had hidden in my mind :)
-- --Guido van Rossum (python.org/~guido)