Re: Pickling dictionaries containing dictionaries: failing, recursion-style!

2007-12-01 Thread John Machin
On Dec 2, 9:49 am, Paul Rubin wrote: > John Machin <[EMAIL PROTECTED]> writes: > > self.words is obviously an iterable (can you see "for word in > > self.words" in his code?), probably just a list. > > It could be a file, in which case its iterator method would read lines

Re: Pickling dictionaries containing dictionaries: failing, recursion-style!

2007-12-01 Thread John Machin
On Dec 2, 8:59 am, lysdexia <[EMAIL PROTECTED]> wrote: > I'm having great fun playing with Markov chains. I am making a > dictionary of all the words in a given string, getting a count of how > many appearances word1 makes in the string, getting a list of all the > word2s that follow each appearan

Re: Pickling dictionaries containing dictionaries: failing, recursion-style!

2007-12-01 Thread Paul Rubin
John Machin <[EMAIL PROTECTED]> writes: > self.words is obviously an iterable (can you see "for word in > self.words" in his code?), probably just a list. It could be a file, in which case its iterator method would read lines from the file and cause that error message. But I think the answer is t

Re: Pickling dictionaries containing dictionaries: failing, recursion-style!

2007-12-01 Thread John Machin
On Dec 2, 9:13 am, Paul Rubin wrote: > lysdexia <[EMAIL PROTECTED]> 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. Wht?? self.words is obvio

Re: Pickling dictionaries containing dictionaries: failing, recursion-style!

2007-12-01 Thread David Tweet
Are you opening the file in binary mode ("rb") before doing pickle.load on it? On 01 Dec 2007 14:13:33 -0800, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > lysdexia <[EMAIL PROTECTED]> writes: > > self.wordDB[word] = [self.words.count(word), wordsWeights] > > what is self.words.coun

Re: Pickling dictionaries containing dictionaries: failing, recursion-style!

2007-12-01 Thread Paul Rubin
lysdexia <[EMAIL PROTECTED]> 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. -- http://mail.python.org/mailman/listinfo/python-list

Pickling dictionaries containing dictionaries: failing, recursion-style!

2007-12-01 Thread lysdexia
I'm having great fun playing with Markov chains. I am making a dictionary of all the words in a given string, getting a count of how many appearances word1 makes in the string, getting a list of all the word2s that follow each appearance of word1 and a count of how many times word2 appears in the