a pickle's pickle
Magnus Lycka
lycka at carmen.se
Tue Aug 2 12:34:51 EDT 2005
temposs at gmail.com wrote:
> class TrainingMatrix:
> matrix = []
> estimator = {}
> wordInfo = {}
> contextInfo = {}
> totalWordsProcessed = 0
> numWords = 0
> numContexts = 0
> matrixWords = 0
Is there some confusion between the scope of the class
object and the scopes of the instance objects perhaps?
Are you aware of this distinction? See below:
>>> class X:
... m=0
...
>>> X.m
0
>>> x=X()
>>> x.m
0
>>> x.m += 5
>>> x.m
5
>>> X.m
0
Are you pickling the class object or an instance?
If you are pickling the class: Why? Is the data
really in the class object?
If you are pickling an instance:
Is the data in the class object?
Is the data in another instance object?
More information about the Python-list
mailing list