On Thu, Oct 14, 2021 at 08:36:37AM -0000, Jeremiah Vivian wrote: > So I implemented these functions as operators in a downloaded source > of CPython... the differences are insane! (Sorry if this produces > nested quotes)
> > >>> import timeit > > # d + 1 vs list(d.values())[0]: 2133x speedup d is a dict. You are trying to add 1 to a dict. Why? `list(d.values())[0]` is a terrible way to extract a single value from a dict. Of course it is going to be slow. -- Steve _______________________________________________ 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/TZCSOBM4VKINENJBICM6TDWFDRNYHHND/ Code of Conduct: http://python.org/psf/codeofconduct/