Panda3D
Classes | Functions | Variables

Package stdpy.pickle

Classes

class  Pickler
class  Unpickler

Functions

def dump
def dumps
def load
def loads

Variables

tuple pickle = __import__('pickle')

Detailed Description

This module extends standard Python's pickle module so that it is
capable of writing more efficient pickle files that contain Panda
objects with shared pointers.  In particular, a single Python
structure that contains many NodePaths into the same scene graph will
write the NodePaths correctly when used with this pickle module, so
that when it is unpickled later, the NodePaths will still reference
into the same scene graph together.

If you use the standard pickle module instead, the NodePaths will each
duplicate its own copy of its scene graph.

This is necessary because the standard pickle module doesn't provide a
mechanism for sharing context between different objects written to the
same pickle stream, so each NodePath has to write itself without
knowing about the other NodePaths that will also be writing to the
same stream.  This replacement module solves this problem by defining
a __reduce_persist__() replacement method for __reduce__(), which
accepts a pointer to the Pickler object itself, allowing for shared
context between all objects written by that Pickler.

Unfortunately, cPickle cannot be supported, because it does not
support extensions of this nature. 

Function Documentation

def stdpy.pickle.dump (   obj,
  file,
  protocol = None 
)
def stdpy.pickle.dumps (   obj,
  protocol = None 
)
def stdpy.pickle.load (   file)
def stdpy.pickle.loads (   str)

Variable Documentation

tuple pickle = __import__('pickle')
 All Classes Namespaces Functions Variables Properties