problems with shelve(), collections.defaultdict, self
7stud
7stud at excite.com
Fri Feb 10 21:52:08 EST 2012
On Feb 10, 7:48 pm, 7stud <7s... at excite.com> wrote:
>
> But I cannot get a class that inherits from collections.defaultdict to
> shelve itself:
>
> import collections as c
> import shelve
>
> class Dog(c.defaultdict):
> def __init__(self):
> super().__init__(int, Joe=0)
> print('****', self)
Whoops. I changed:
super().__init__(int, Joe=0)
to:
super().__init__(int, Joe=30)
hence this output..
> --output:--
>
> **** defaultdict(<class 'int'>, {'Joe': 30})
More information about the Python-list
mailing list