Łukasz Langa <luk...@langa.pl> added the comment:

A couple of points:

1. Eric's proposal is what I had in mind with the `fallbackdict' idea.
2. I'm also reluctant to add more variants to the standard library. Then again 
if it contained a `fallbackdict' I wouldn't probably ever use `defaultdict' 
again. How often do you need to provide a factory?
3. Naming the other variant `defaultdict_const', `defaultdict_value', 
`defaultdict_whatever' beats the purpose because it's actually more characters 
to type than `defaultdict(lambda:', especially when you count the longer import 
name.
4. I cannot come up with another typical integer value that would be useful, 
then again I've used "", [] and set() numerous times. Adding zerodict, 
stringdict, listdict, setdict is obviously absurd.
5. The discussion started on Twitter amongst a couple of core devs and 
__missing__ didn't appear to be the one obvious way to anyone.
6. Of course I'm in no position to reject Guido's design on anything. Then 
again even `defaultdict(lambda:' is simply so much shorter than subclassing 
dict.

To sum up: if you don't find the idea of adding `fallbackdict' (possibly with 
an different *short* name) worth it, then I'm +1 on correcting the docs in 
terms of __missing__ and leaving the implementation as is.

----------

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

Reply via email to