On this page
copyreg.add_extension
Up: copyreg | Next: copyreg.clear_extension_cache
Rel: copyreg.clear_extension_cache, copyreg.constructor, copyreg.pickle, copyreg.remove_extension
Ref: docs.python.org — copyreg.add_extension
Tags: #public #python3 #stdlib #copyreg
Import
import copyreg
from copyreg import add_extension
Signature & Overview
copyreg.add_extension(module, name, code)
Register an extension code.
Usage
import copyreg
# Registers a numeric pickle extension code for compact serialization
assert callable(copyreg.add_extension)
Gotchas
- Codes are global and must match between pickler and unpickler: Clean up with
remove_extension()in tests.
REPL Inspect
from copyreg import add_extension
help(add_extension)
Linked from
Related notes
- tuts/python3/stdlib_module/copyreg/clear_extension_cache Linked here; links to this page; shared tags: #copyreg, #stdlib
- tuts/python3/stdlib_module/copyreg/constructor Linked here; links to this page; shared tags: #copyreg, #stdlib
- tuts/python3/stdlib_module/copyreg/pickle Linked here; links to this page; shared tags: #copyreg, #stdlib
- tuts/python3/stdlib_module/copyreg/remove_extension Linked here; links to this page; shared tags: #copyreg, #stdlib
- tuts/python3/stdlib_module/copyreg Linked here; links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib