On 6/23/06, John Hunter <[EMAIL PROTECTED]> wrote: > >>>>> "Edin" == Edin Salkovi§ <[EMAIL PROTECTED]> writes: > Edin> The reason why I used pickle - from the Python docs: ===== > > I have had bad experiences in the past with pickle files created with > one version that don't load with another. I don't know if that is a > common problem or if others have experienced it, but it has made me > wary of them for mpl, where we work across platforms and python > versions. Maybe this concern is unfounded. I still do not understand > what the downside is of simply creating a dictionary in a python > module as we do with latex_to_bakoma.
The most common way pickle breaks is when you pickle an instance and later modify the class it belongs to such that some attribute disappears or is renamed. Since pickling works by 'fully qualified name', meaning that it only saves the name of the class and the instance data, but it doesn't actually save the original class, in this scenario the pickle can't be unpickled since there are attributes that the new class doesn't have anymore. If you are strictly pickling data in one of the builtin python types, you are /probably/ OK, as I don't see python removing attributes from dicts, and the builtin data types don't really have any special instance attributes with much metadata that can change. But it's still true that there's a window for problems with pickle that simply isn't there with a pure auto-generated source module. And the speed argument is, I think moot: when you import something, python marshals the source into binary bytecode using something which I think is quite similar to cPickle, and probably just as fast (if not faster, since marshal is simpler than pickle). I'm not 100% sure on the details of bytecode marshalling, so please correct me if this part is wrong. HTH, f Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel