Question about collections.defaultdict

S

Steven W. Orr

I created a new class called CaseInsensitiveDict (by stealing from code I
found on the web, thank you very much). The new class inherits from dict. It
makes it so that if the key has a 'lower' method, it will always access the
key using lower

I'd like to change the place where I previously declared a dict

self.lookup = defaultdict(list)

so that the new code will allow this new dict to be used instead. But then I
realized I may have painted myself into a small corner:

Is there a way to use defaultdict so that I can override what *kind* of dict
it will use?

I would like the value to still be a list be default, but it seems like I
can't tell defaultdict to use *my* new dict.

Do I give up on defaultdict?

BTW, 2.6 if it matters.

TIA :)

--
Time flies like the wind. Fruit flies like a banana. Stranger things have .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top