Author rb
Recipients rb
Date 2009-03-19.15:53:48
SpamBayes Score 3.06848e-10
Marked as misclassified No
Message-id <1237478032.19.0.310078929224.issue5518@psf.upfronthosting.co.za>
In-reply-to
Content
The documentation states that the output of pickle and cPickle may be
different. However it is implied that the output of a particular module
will always be consistent within itself. This expectation fails for the
case below.

I am using the output of cPickle in order to generate a key to use for
external storage where the key is abstracted to a generic Python
(immutable) object. Without consistency this breaks for me; pickle is
too slow so I need to use cPickle.

$ python
Python 2.5.2 (r252:60911, Oct  5 2008, 19:29:17) 
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cPickle
>>> key = (1, u'foo')
>>> cPickle.dumps(key)
'(I1\nVfoo\ntp1\n.'
>>> cPickle.dumps((1, u'foo'))
'(I1\nVfoo\np1\ntp2\n.'

PythonWin 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit
(Intel)] 
on win32.
Portions Copyright 1994-2008 Mark Hammond - see 'Help/About PythonWin' for 
further copyright information.
>>> import cPickle
>>> key = (1,u'foo')
>>> cPickle.dumps(key)
'(I1\nVfoo\ntp1\n.'
>>> cPickle.dumps((1,u'foo'))
'(I1\nVfoo\np1\ntp2\n.'

Expected results: the output of the two dumps calls should be the same.
History
Date User Action Args
2009-03-19 15:53:52rbsetrecipients: + rb
2009-03-19 15:53:52rbsetmessageid: <1237478032.19.0.310078929224.issue5518@psf.upfronthosting.co.za>
2009-03-19 15:53:50rblinkissue5518 messages
2009-03-19 15:53:48rbcreate