On May 16, 1:13 pm, Victor Kryukov <[EMAIL PROTECTED]> wrote: > Hello list, > > I've found the following strange behavior of cPickle. Do you think > it's a bug, or is it by design? > > Best regards, > Victor. > > from pickle import dumps > from cPickle import dumps as cdumps > > print dumps('1001799')==dumps(str(1001799)) > print cdumps('1001799')==cdumps(str(1001799)) > > outputs > > True > False > > vicbook:~ victor$ python > Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) > [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin > Type "help", "copyright", "credits" or "license" for more information.>>> > quit() > > vicbook:~ victor$ uname -a > Darwin vicbook 8.9.1 Darwin Kernel Version 8.9.1: Thu Feb 22 20:55:00 > PST 2007; root:xnu-792.18.15~1/RELEASE_I386 i386 i386
If you unpickle though will the results be the same? I suspect they will be. That should matter most of all (unless you plan to compare objects' identity based on their pickled version.) Remember, that by default pickle and cPickle will create a longer ASCII representation, for a binary representation use a higher pickle protocol -- 2 instead of 1. Hope that helps, -Nick Vatamaniuc -- http://mail.python.org/mailman/listinfo/python-list