Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #22187 > unrolled thread

Question about collections.defaultdict

Started by"Steven W. Orr" <steveo@syslang.net>
First post2012-03-26 09:33 -0400
Last post2012-03-26 09:33 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Question about collections.defaultdict "Steven W. Orr" <steveo@syslang.net> - 2012-03-26 09:33 -0400

#22187 — Question about collections.defaultdict

From"Steven W. Orr" <steveo@syslang.net>
Date2012-03-26 09:33 -0400
SubjectQuestion about collections.defaultdict
Message-ID<mailman.1001.1332768827.3037.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web