On Thu, 17 Sep 2020 at 05:31, Inada Naoki <songofaca...@gmail.com> wrote:
>
> On Thu, Sep 17, 2020 at 8:03 AM Marco Sulla
> <marco.sulla.pyt...@gmail.com> wrote:
> >
> > python -m timeit -n 2000  --setup "from uuid import uuid4 ; o =
> > {str(uuid4()).replace('-', '') : str(uuid4()).replace('-', '') for i
> > in range(10000)}" "dict(**o)"
> >
>
> I don't think this use case is worth to optimize, because `dict(o)` or
> `o.copy()` is Pythonic.

Well, also {**dict1, **dict2} is pythonic. Anyway, I used **dict as a
shortcut for testing keyword assignment.
For doing this I "only" cloned PyDict_SetItem and insertdict.

I do not like code duplication, but dictobject.c has already a lot of
duplicated copies of the same function for optimization (see
lookdict).
_______________________________________________
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/IID5E4TYV2ZLAXWSCQL6YJWZN4XO54BA/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to