[docs] [issue20823] Clarify copyreg.pickle() documentation

Peter Otten report at bugs.python.org
Sun Mar 2 09:46:06 CET 2014

New submission from Peter Otten:

The documentation for 

copyreg.pickle(type, function, constructor=None)

has the sentence

"TypeError will be raised if *object* is a class or *constructor* is not callable."

It's not clear to me what "object" refers to. I believe it refers to the first arg (called ob_type in 2.x) and classic classes which were handled with

def pickle(ob_type, pickle_function, constructor_ob=None):
    if type(ob_type) is _ClassType:
        raise TypeError("copy_reg is not intended for use with classes")

in 2.x If I'm right the above sentence should become.

"A TypeError will be raised if *constructor* is not callable."

in 3.x. If I'm wrong please think of way to express the intended meaning more clearly.

Another minor change: class C need not inherit from object explicitly in  3.x.

assignee: docs at python
components: Documentation
messages: 212541
nosy: docs at python, peter.otten
priority: normal
severity: normal
status: open
title: Clarify copyreg.pickle() documentation
versions: Python 3.3

Python tracker <report at bugs.python.org>

More information about the docs mailing list