julien tayon wrote:
like the + of [] could be the + of "RecordAlgebrae"
If you're proposing to change the behaviour of '+' on the
built-in list type, that's not going to happen.
I dont suggest to change something that already exists and works (I am
On Tue, 30 Oct 2018 at 22:33, Greg Ewing
wrote:
pretty conservative too, and expect stuff to not be broken by any changes)
And all behaviours can coexists quite peacefully.
"RecordAlgebra"
In [5]: [2] + [2]
Out[5]: [2, 2]
In [6]: [2] * 2
Out[6]: [2, 2]
In [7]: "a" + "a"
Out[7]: 'aa'
In [8]: "a" * 2
Out[8]: 'aa'
(adding n times the same value is equal to multiplying by n // that is
totally consistent to me)
Mixed scenario :
In [12]: a= mdict(a=[2], b='a')
In [13]: a+a
Out[14]: {'a': [2, 2], b='aa'}
In [17]: a * 4
Out[17]: {'a': [2, 2, 2, 2], b='aaaa'}
I propose the operators to be propagated, and any value to still follow its
logic.
LibearAlgebraic MutableMapping would be as algebraic as their values. No
more.
--
Greg
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/