On 9/02/2009 8:51 PM, Barak, Ron wrote:
Hi John,
Thanks for the suggestion.
What I do now in preparation for pickling is:
for_pickle_log_stream = LogStream(sac_log_file)
for key in log_stream.__dict__:
if key != "input_file":
for_pickle_log_stream.__dict__[key] =
log_stream.__dict__[key]
del for_pickle_log_stream.__dict__["input_file"]
(i.e., log_stream is the source instance, and for_pickle_log_stream is
the target)
So, it seems to be in agreement with your suggestion.
which was
"""
If there is no chance that some other thread could be accessing the
source object, can't the OP just do:
temp = source.stringio
del source.stringio
# make a pickle from source
source.stringio = temp
"""
which I regard as radically different to your approach; please explain
what you mean by "in agreement with".
--
http://mail.python.org/mailman/listinfo/python-list