Anders Hovmöller wrote:
> It would have been better with a dedicated concat operator I think but just a 
> little bit better.

Interesting little side note, for anyone who doesn't already know: at the C 
level, Python objects have two ways of implementing addition and 
multiplication. The first is through the "numeric" `tp_as_number` interface, 
which exposes our well-known `__add__` / `__mul__` trios of methods. The second 
is through the `tp_as_sequence` interface, where we can define "concat" / 
"inplace concat" / "repeat" / "inplace repeat" functions to do the same thing 
(at least it's mostly the same when working in the Python layer). Sequence 
repetition and concatenation are very strongly baked into the Python's object 
model, even if it's not immediately obvious from further up.

The C implementation for this proposal uses the latter interface, for a few 
technical reasons that I won't dive into here. This means, though, that it 
really can be accurately thought of as "dict concatenation".
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/WLYGCUL6JJFIIHC36MWCP2VNYXKV5CP4/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to