Message353209
> 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. |
|
Date |
User |
Action |
Args |
2019-09-25 14:52:10 | vstinner | set | recipients:
+ vstinner, serhiy.storchaka, benspiller |
2019-09-25 14:52:09 | vstinner | set | messageid: <1569423129.89.0.0793122516367.issue38278@roundup.psfhosted.org> |
2019-09-25 14:52:09 | vstinner | link | issue38278 messages |
2019-09-25 14:52:09 | vstinner | create | |
|