[Haizea] Is it right?__setstate__

柯俊峰 kjf620520 at gmail.com
Fri Dec 18 06:25:44 CST 2009


The __setstate__ like this:
def __setstate__(self, state):
        """Restores state when unpickling a ResourceTuple object

        After unpickling, the object still has to be bound to a slottable.
        """
        self.slottable = None
        self._single_instance = state[0]
        self._multi_instance = state[1]
Above codes may be as follows,
def __setstate__(self, state):
        """Restores state when unpickling a ResourceTuple object

        After unpickling, the object still has to be bound to a slottable.
        """
        self.slottable = None
        self._single_instance = state[0]
        if len(state) == 2:
        self._multi_instance = state[1]
Is it right?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.uchicago.edu/pipermail/haizea/attachments/20091218/1ab9bc84/attachment.htm 


More information about the Haizea mailing list