On Fri, 02 Jul 2010 04:11:49 +, Steven D'Aprano wrote:
> I would like to better understand some of the design choices made in
> collections.defaultdict.
[...]
Thanks to all who replied.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On 07/02/2010 11:26 AM, Chris Rebert wrote:
> On Fri, Jul 2, 2010 at 2:20 AM, Thomas Jollans wrote:
>> On 07/02/2010 06:11 AM, Steven D'Aprano wrote:
>>> I would like to better understand some of the design choices made in
>>> collections.defaultdict.
>
>>> Second, why is the factory function not
On Fri, Jul 2, 2010 at 2:20 AM, Thomas Jollans wrote:
> On 07/02/2010 06:11 AM, Steven D'Aprano wrote:
>> I would like to better understand some of the design choices made in
>> collections.defaultdict.
>> Second, why is the factory function not called with key? There are three
>> obvious kinds o
On 07/02/2010 06:11 AM, Steven D'Aprano wrote:
> I would like to better understand some of the design choices made in
> collections.defaultdict.
>
> Firstly, to initialise a defaultdict, you do this:
>
> from collections import defaultdict
> d = defaultdict(callable, *args)
>
> which sets an at
On Jul 1, 9:11 pm, Steven D'Aprano wrote:
> I would like to better understand some of the design choices made in
> collections.defaultdict.
. . .
> If callable is None, defaultdicts are
> *exactly* equivalent to built-in dicts, so I wonder why the API wasn't
> added on to dict rather than a separ
On Thu, Jul 1, 2010 at 9:11 PM, Steven D'Aprano
wrote:
> I would like to better understand some of the design choices made in
> collections.defaultdict.
Perhaps python-dev should've been CC-ed...
> Firstly, to initialise a defaultdict, you do this:
>
> from collections import defaultdict
> d = d
I would like to better understand some of the design choices made in
collections.defaultdict.
Firstly, to initialise a defaultdict, you do this:
from collections import defaultdict
d = defaultdict(callable, *args)
which sets an attribute of d "default_factory" which is called on key
lookups wh