A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-November/122736.html below:

[Python-Dev] performance of {} versus dict()

[Python-Dev] performance of {} versus dict()martin at v.loewis.de martin at v.loewis.de
Thu Nov 15 06:04:57 CET 2012
Zitat von Chris Angelico <rosuav at gmail.com>:

> On Thu, Nov 15, 2012 at 1:28 PM, Stephen J. Turnbull  
> <stephen at xemacs.org> wrote:
>> Chris Angelico writes:
>>
>>  > >>> {"a":1}+{"b":2}
>>
>>  > It would make sense for this to result in {"a":1,"b":2}.
>>
>> The test is not "does this sometimes make sense?"  It's "does this
>> ever result in nonsense, and if so, do we care?"
>>
>> Here, addition is usually commutative.  Should {'a':1}+{'a':2} be the
>> same as, or different from, {'a':2}+{'a':1}, or should it be an error?
>
>>>> "a"+"b"
> 'ab'
>>>> "b"+"a"
> 'ba'
>
> I would say that the two dictionary examples are equally allowed to
> give different results - that they should be equivalent to (shallow)
> copy followed by update(), but possibly more efficiently.

Can this be moved to python-ideas, please?

Regards,
Martin



More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4