Kirill Simonov wrote:
> Could someone explain why __reduce__(2) works for files while
> __reduce__(1) doesn't?
I think it is a bug. Both should raise an error.
__reduce__ and __reduce_ex__ are part of the pickle protocol.
Files are not meant to be pickable, since they are already
persistent. With
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 "", line 1, in ?
File "/usr/lib/python2.4/copy_reg.py", line 69, in _reduce_ex
raise TypeError, "can't pickle %s obje