After reading this question, I noticed that S. Lott might have liked to use an “ordered defaultdict”, but it doesn't exist. Now, I wonder: Why do we have so many dict classes in Python?
Why not have something like this,
dict(initializer=[], sorted=False, ordered=False, default=None,
weak_keys=False, weak_values=False)
that unifies everything, and provides every useful combination?
One issue is that making this change would break backward-compatibility, due to this type of constructor usage that exists now:
>>> dict(one=1, two=2)
{'two': 2, 'one': 1}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With