#StackBounty: #python #inheritance #pickle #defaultdict Can't pickle recursive nested defaultdict

Bounty: 50

I have a recursive nested defaultdict class defined as

from collections import defaultdict

class NestedDict(defaultdict):
    def __init__(self):

sitting in a nested_dict.py file.

When I try to pickle it, e.g.

import pickle
from nested_dict import NestedDict

d = NestedDict()

I get TypeError: __init__() takes 1 positional argument but 2 were given.

What’s exactly happening here?

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.