[Python-ideas] Why operators are useful
rosuav at gmail.com
Fri Mar 15 21:49:17 EDT 2019
On Sat, Mar 16, 2019 at 12:40 PM Raymond Hettinger
<raymond.hettinger at gmail.com> wrote:
> Also, it seems like the efficiency concerns were dismissed with hand-waving. But usually, coping and updating aren't the desired behavior. When teaching Python, I like to talk about how the design of the language nudges you towards fast, clear, correct code. The principle is that things that are good for you are put within easy reach. Things that require more thought are placed a little further away. That is the usual justification for copy() and deepcopy() having to be imported rather than being builtins. Copying is an obvious thing to do; it is also not usually good for you; so, we have you do one extra step to get to it.
I'm not sure I understand this argument. Are you saying that d1+d2 is
bad code because it will copy the dictionary, and therefore it
shouldn't be done? Because the exact same considerations apply to the
addition of two lists, which already exists in the language. Is it bad
to add lists together instead of using extend()?
More information about the Python-ideas