Could someone explain why __reduce__(2) works for files while __reduce__(1) doesn't?
>>> f = file('/etc/passwd') >>> f.__reduce__(1) Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib/python2.4/copy_reg.py", line 69, in _reduce_ex raise TypeError, "can't pickle %s objects" % base.__name__ TypeError: can't pickle file objects >>> f.__reduce__(2) (<function __newobj__ at 0xb7e6317c>, (<type 'file'>,), None, None, None) What is a correct procedure of getting state and restoring Python objects? -- xi -- http://mail.python.org/mailman/listinfo/python-list