This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients benspiller, serhiy.storchaka, vstinner
Date 2019-09-25.14:52:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1569423129.89.0.0793122516367.issue38278@roundup.psfhosted.org>
In-reply-to
Content
> Lots of solutions are possible - maybe some kind of peephole optimization to make dict.get() itself perform similarly to the [] operator, or if that's challenging perhaps providing a class or option that behaves like defaultdict but without the auto-adding behaviour and with comparable [] performance to the "dict" type - for example dict.raiseExceptionOnMissing=False, or perhaps even some kind of new syntax (e.g. dict['key', default=None]). Which option would be easiest/nicest?

This issue doesn't propose any concrete solution, but discuss ideas. I suggest you to open a thread on the python-ideas mailing list instead. I suggest to close this issue.

I bet that defaultdict is *not* faster once you will manage to write a fair micro-benchmark.
History
Date User Action Args
2019-09-25 14:52:10vstinnersetrecipients: + vstinner, serhiy.storchaka, benspiller
2019-09-25 14:52:09vstinnersetmessageid: <1569423129.89.0.0793122516367.issue38278@roundup.psfhosted.org>
2019-09-25 14:52:09vstinnerlinkissue38278 messages
2019-09-25 14:52:09vstinnercreate