STINNER Victor <vstin...@python.org> added the comment:

> 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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38278>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to