[cctbxbb] "import pickle"

markus.gerstel at diamond.ac.uk markus.gerstel at diamond.ac.uk
Fri Sep 23 09:31:41 PDT 2016


Hi everyone,

I note that we are using "import pickle" on some 57 occasions.
Is there a particular reason we don't import cPickle? For example:

--- libtbx/env_config.py        (revision 25451)
+++ libtbx/env_config.py        (working copy)
@@ -7,7 +7,10 @@
 from libtbx import adopt_init_args
 import platform
 import shutil
-import pickle
+try:
+  import cPickle as pickle
+except:
+  import pickle
 from cStringIO import StringIO
 import re
 import sys, os

This should still work on all systems without issue. According to python docs the only difference is that cPickle can't be subclassed.
If it's alright with you I would go through those imports and update them to use cPickle where possible.

-Markus

-- 
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. 
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom




More information about the cctbxbb mailing list