PEP: XXX Title: Serialization of Simple Python Types Version: $Revision: $ Last-Modified: $Date: $ Author: Simon Wittber Status: Draft Type: Standards Track Python-Version: 2.4 Content-Type: text/plain Created: 19-Jun-2005 Post-History: Abstract This PEP suggests the addition of a module to the standard library, which provides a serialization class for simple Python types. Copyright This document is placed in the public domain. Motivation The standard library currently provides two modules which are used for object serialization. Pickle is not secure by its very nature, and the marshal module is clearly marked as being not secure in the documentation. The marshal module does not guarantee compatibility between Python versions. The proposed module will only serialize simple built-in Python types, and provide compatibility across Python versions. See RFE 467384 (on SourceForge) for past discussions on the above issues. Specification The proposed module should use the same API as the marshal module. dump(value, file) #serialize value, and write to open file object load(file) #read data from file object, unserialize and return an object dumps(value) #return the string that would be written to the file by dump loads(value) #unserialize and return object Reference Implementation Please see attached sencode.py Rationale An algorithm using a single encode function, in which an if/elif structure is used, rather than a dict lookup by type, proved to be slower than the algorithm used in the reference implementation. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: