Pickling dictionaries containing dictionaries: failing, recursion-style!

John Machin sjmachin at lexicon.net
Sat Dec 1 17:44:08 EST 2007


On Dec 2, 9:13 am, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> lysdexia <doug.shaw... at gmail.com> writes:
> >         self.wordDB[word] = [self.words.count(word), wordsWeights]
>
> what is self.words.count?  Could it be an iterator?  I don't think you
> can pickle those.

Whaaaat??
self.words is obviously an iterable (can you see "for word in
self.words" in his code?), probably just a list.
self.words.count looks like a standard sequence method to me.
self.words.count(word) will return an int -- can you see all those
"[1,", "[2," etc in his printed dict output?



More information about the Python-list mailing list