[Python-Dev] to rename or not...
Ronald Oussoren
ronaldoussoren at mac.com
Wed Jul 31 08:15:50 CEST 2013
Hi,
The relevant issue for this question is <http://bugs.python.org/issue14455>
Plistlib contains object serialization logic that is in spirit simular to json and pickle, but has a different output format and different limitations. The functions in the module don't reflect that though, they are "readPlist" and "writePlist" instead of "load" and "dump".
While working on the issue I noticed something uglier than that: plistlib in py3k inherits a design decision that was necessary in py2 and feels decidedly odd in py3k. It represents binary data objects of type plistlib.Data instead of bytes. Those objects have an attribute with the actual data. The distinction was necessary in Python 2 to make it possible to keep binary data and strings apart, but is no longer necessary in Python 3.
Because of this I'd like to introduce a new API in plistlib that fixes both problems. In particular:
* Add 'load', 'loads', 'dump' and 'dumps', those use "bytes" for binary data by default
* Keep and deprecate "readPlist", "writePlist" and the their string equivalents, those still use Data objects (and call the new API to do the actual work).
I'd like some feedback on this change. On the one hand the new APIs make it possible to clean up the API of plistlib, on the other hand this is a big API change.
Ronald
P.S. The issue itself is about adding support for binary plist files, I got a bit carried away while testing and refactoring the original patch :-(
More information about the Python-Dev
mailing list