mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00

svn+ssh://pythondev@svn.python.org/python/trunk ........ r60701 | georg.brandl | 2008-02-09 22:36:15 +0100 (Sat, 09 Feb 2008) | 2 lines Needs only 2.4 now. ........ r60702 | georg.brandl | 2008-02-09 22:38:54 +0100 (Sat, 09 Feb 2008) | 2 lines Docs are rst now. ........ r60703 | georg.brandl | 2008-02-09 23:00:00 +0100 (Sat, 09 Feb 2008) | 2 lines Fix link. ........ r60704 | georg.brandl | 2008-02-10 00:09:25 +0100 (Sun, 10 Feb 2008) | 2 lines Fix for newest doctools. ........ r60709 | raymond.hettinger | 2008-02-10 08:21:09 +0100 (Sun, 10 Feb 2008) | 1 line Clarify that decimal also supports fixed-point arithmetic. ........ r60710 | nick.coghlan | 2008-02-10 08:32:52 +0100 (Sun, 10 Feb 2008) | 1 line Add missing NEWS entry for r60695 ........ r60712 | mark.dickinson | 2008-02-10 15:58:38 +0100 (Sun, 10 Feb 2008) | 3 lines Turn classmethods into staticmethods, and avoid calling the constructor of subclasses of Rational. (See discussion in issue #1682.) ........ r60715 | mark.dickinson | 2008-02-10 16:19:58 +0100 (Sun, 10 Feb 2008) | 2 lines Typos in decimal comment and documentation ........ r60716 | skip.montanaro | 2008-02-10 16:31:54 +0100 (Sun, 10 Feb 2008) | 2 lines Get the saying right. ;-) ........ r60717 | skip.montanaro | 2008-02-10 16:32:16 +0100 (Sun, 10 Feb 2008) | 2 lines whoops - revert ........ r60718 | mark.dickinson | 2008-02-10 20:23:36 +0100 (Sun, 10 Feb 2008) | 2 lines Remove reference to Rational ........ r60719 | raymond.hettinger | 2008-02-10 21:35:16 +0100 (Sun, 10 Feb 2008) | 1 line Complete an open todo on pickletools -- add a pickle optimizer. ........ r60721 | mark.dickinson | 2008-02-10 22:29:51 +0100 (Sun, 10 Feb 2008) | 3 lines Rename rational.Rational to fractions.Fraction, to avoid name clash with numbers.Rational. See issue #1682 for related discussion. ........ r60722 | christian.heimes | 2008-02-11 03:26:22 +0100 (Mon, 11 Feb 2008) | 1 line The test requires the network resource ........ r60723 | mark.dickinson | 2008-02-11 04:11:55 +0100 (Mon, 11 Feb 2008) | 3 lines Put an extra space into the repr of a Fraction: Fraction(1, 2) instead of Fraction(1,2). ........
42 lines
1.9 KiB
ReStructuredText
42 lines
1.9 KiB
ReStructuredText
|
|
:mod:`pickletools` --- Tools for pickle developers.
|
|
===================================================
|
|
|
|
.. module:: pickletools
|
|
:synopsis: Contains extensive comments about the pickle protocols and pickle-machine
|
|
opcodes, as well as some useful functions.
|
|
|
|
|
|
This module contains various constants relating to the intimate details of the
|
|
:mod:`pickle` module, some lengthy comments about the implementation, and a few
|
|
useful functions for analyzing pickled data. The contents of this module are
|
|
useful for Python core developers who are working on the :mod:`pickle` and
|
|
:mod:`cPickle` implementations; ordinary users of the :mod:`pickle` module
|
|
probably won't find the :mod:`pickletools` module relevant.
|
|
|
|
|
|
.. function:: dis(pickle[, out=None, memo=None, indentlevel=4])
|
|
|
|
Outputs a symbolic disassembly of the pickle to the file-like object *out*,
|
|
defaulting to ``sys.stdout``. *pickle* can be a string or a file-like object.
|
|
*memo* can be a Python dictionary that will be used as the pickle's memo; it can
|
|
be used to perform disassemblies across multiple pickles created by the same
|
|
pickler. Successive levels, indicated by ``MARK`` opcodes in the stream, are
|
|
indented by *indentlevel* spaces.
|
|
|
|
|
|
.. function:: genops(pickle)
|
|
|
|
Provides an :term:`iterator` over all of the opcodes in a pickle, returning a
|
|
sequence of ``(opcode, arg, pos)`` triples. *opcode* is an instance of an
|
|
:class:`OpcodeInfo` class; *arg* is the decoded value, as a Python object, of
|
|
the opcode's argument; *pos* is the position at which this opcode is located.
|
|
*pickle* can be a string or a file-like object.
|
|
|
|
.. function:: optimize(picklestring)
|
|
|
|
Returns a new equivalent pickle string after eliminating unused ``PUT``
|
|
opcodes. The optimized pickle is shorter, takes less transmission time,
|
|
requires less storage space, and unpickles more efficiently.
|
|
|
|
.. versionadded:: 2.6
|