René's URL Explorer Experiment
go
Title:
Structs
direct link
Domain:
msgspec.dev
color-scheme
light dark
Links
:
Skip to content
https://msgspec.dev/structs#furo-main-content
msgspec
https://msgspec.dev/index.html
https://msgspec.dev/index.html
Why msgspec?
https://msgspec.dev/why.html
Installation
https://msgspec.dev/install.html
Benchmarks
https://msgspec.dev/benchmarks.html
Usage
https://msgspec.dev/usage.html
Supported Types
https://msgspec.dev/supported-types.html
Structs
https://msgspec.dev/structs
Constraints
https://msgspec.dev/constraints.html
Converters
https://msgspec.dev/converters.html
JSON Schema
https://msgspec.dev/jsonschema.html
Schema Evolution
https://msgspec.dev/schema-evolution.html
Extending
https://msgspec.dev/extending.html
Inspecting Types
https://msgspec.dev/inspect.html
Performance Tips
https://msgspec.dev/perf-tips.html
Porting guides
https://msgspec.dev/porting/index.html
Porting from orjson
https://msgspec.dev/porting/orjson.html
API Docs
https://msgspec.dev/api.html
Examples
https://msgspec.dev/examples/index.html
GeoJSON
https://msgspec.dev/examples/geojson.html
Asyncio TCP Key-Value Server
https://msgspec.dev/examples/asyncio-kv.html
Conda Repodata
https://msgspec.dev/examples/conda-repodata.html
Parsing pyproject.toml
https://msgspec.dev/examples/pyproject-toml.html
Changelog
https://msgspec.dev/changelog.html
Back to top
https://msgspec.dev/structs
View this page
https://msgspec.dev/_sources/structs.rst.txt
¶
https://msgspec.dev/structs#structs
measurably faster
https://msgspec.dev/benchmarks.html
dataclasses
https://docs.python.org/3/library/dataclasses.html
attrs
https://www.attrs.org/en/stable/index.html
pydantic
https://pydantic.dev/docs/validation/latest/get-started/
msgspec.Struct
https://msgspec.dev/api.html#msgspec.Struct
str
https://docs.python.org/3/library/stdtypes.html#str
str
https://docs.python.org/3/library/stdtypes.html#str
None
https://docs.python.org/3/library/constants.html#None
None
https://docs.python.org/3/library/constants.html#None
set
https://docs.python.org/3/library/stdtypes.html#set
str
https://docs.python.org/3/library/stdtypes.html#str
pattern matching
https://docs.python.org/3/reference/compound_stmts.html#the-match-statement
rich
https://rich.readthedocs.io/en/stable/pretty.html
[email protected]
https://msgspec.dev/cdn-cgi/l/email-protection
[email protected]
https://msgspec.dev/cdn-cgi/l/email-protection
Post-Init Processing
https://msgspec.dev/structs#struct-post-init
¶
https://msgspec.dev/structs#default-values
msgspec.field
https://msgspec.dev/api.html#msgspec.field
common gotcha
https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments
lambda
https://docs.python.org/3/tutorial/controlflow.html#lambda-expressions
functools.partial
https://docs.python.org/3/library/functools.html#functools.partial
¶
https://msgspec.dev/structs#post-init-processing
of the same name
https://docs.python.org/3/library/dataclasses.html#post-init-processing
TypeError
https://docs.python.org/3/library/exceptions.html#TypeError
ValueError
https://docs.python.org/3/library/exceptions.html#ValueError
msgspec.ValidationError
https://msgspec.dev/api.html#msgspec.ValidationError
¶
https://msgspec.dev/structs#field-ordering
keyword-only parameters
https://docs.python.org/3/glossary.html#term-parameter
dataclasses
https://docs.python.org/3/library/dataclasses.html#module-dataclasses
dataclasses docs
https://msgspec.dev/dataclasses
¶
https://msgspec.dev/structs#class-variables
dataclasses
https://docs.python.org/3/library/dataclasses.html#module-dataclasses
msgspec.Struct
https://msgspec.dev/api.html#msgspec.Struct
typing.ClassVar
https://docs.python.org/3/library/typing.html#typing.ClassVar
PEP 563
https://peps.python.org/pep-0563/
¶
https://msgspec.dev/structs#type-validation
pydantic
https://pydantic.dev/docs/validation/latest/get-started/
msgspec.Struct
https://msgspec.dev/api.html#msgspec.Struct
mypy
https://mypy.readthedocs.io/en/stable/
pyright
https://github.com/microsoft/pyright
msgspec.Struct
https://msgspec.dev/api.html#msgspec.Struct
dict
https://docs.python.org/3/library/stdtypes.html#dict
¶
https://msgspec.dev/structs#pattern-matching
msgspec.Struct
https://msgspec.dev/api.html#msgspec.Struct
pattern matching
https://docs.python.org/3/reference/compound_stmts.html#the-match-statement
PEP 636
https://peps.python.org/pep-0636/
¶
https://msgspec.dev/structs#equality-and-order
¶
https://msgspec.dev/structs#frozen-instances
¶
https://msgspec.dev/structs#tagged-unions
Tagged Unions
https://en.wikipedia.org/wiki/Tagged_union
¶
https://msgspec.dev/structs#omitting-default-values
[email protected]
https://msgspec.dev/cdn-cgi/l/email-protection
[email protected]
https://msgspec.dev/cdn-cgi/l/email-protection
msgspec.json.encode
https://msgspec.dev/api.html#msgspec.json.encode
msgspec.msgpack.encode
https://msgspec.dev/api.html#msgspec.msgpack.encode
msgspec.yaml.encode
https://msgspec.dev/api.html#msgspec.yaml.encode
msgspec.toml.encode
https://msgspec.dev/api.html#msgspec.toml.encode
msgspec.to_builtins
https://msgspec.dev/api.html#msgspec.to_builtins
msgspec.structs.asdict
https://msgspec.dev/api.html#msgspec.structs.asdict
msgspec.structs.astuple
https://msgspec.dev/api.html#msgspec.structs.astuple
Converting to and from Builtin Types
https://msgspec.dev/usage.html#to-builtins-vs-asdict
¶
https://msgspec.dev/structs#forbidding-unknown-fields
Schema Evolution
https://msgspec.dev/schema-evolution.html
¶
https://msgspec.dev/structs#renaming-fields
msgspec.field
https://msgspec.dev/api.html#msgspec.field
msgspec.field
https://msgspec.dev/api.html#msgspec.field
msgspec.field
https://msgspec.dev/api.html#msgspec.field
¶
https://msgspec.dev/structs#encoding-decoding-as-arrays
Tagged Unions
https://msgspec.dev/structs#struct-tagged-unions
¶
https://msgspec.dev/structs#runtime-definition
msgspec.Struct
https://msgspec.dev/api.html#msgspec.Struct
msgspec.defstruct
https://msgspec.dev/api.html#msgspec.defstruct
dataclasses.make_dataclass
https://docs.python.org/3/library/dataclasses.html#dataclasses.make_dataclass
msgspec.defstruct
https://msgspec.dev/api.html#msgspec.defstruct
¶
https://msgspec.dev/structs#advanced
¶
https://msgspec.dev/structs#metaclasses
msgspec.Struct
https://msgspec.dev/api.html#msgspec.Struct
msgspec.StructMeta
https://msgspec.dev/api.html#msgspec.StructMeta
msgspec.StructMeta
https://msgspec.dev/api.html#msgspec.StructMeta
abc.ABCMeta
https://docs.python.org/3/library/abc.html#abc.ABCMeta
msgspec.Struct
https://msgspec.dev/api.html#msgspec.Struct
isinstance()
https://docs.python.org/3/library/functions.html#isinstance
issubclass()
https://docs.python.org/3/library/functions.html#issubclass
msgspec.StructMeta
https://msgspec.dev/api.html#msgspec.StructMeta
msgspec.Struct
https://msgspec.dev/api.html#msgspec.Struct
msgspec.StructMeta
https://msgspec.dev/api.html#msgspec.StructMeta
abc.ABCMeta
https://docs.python.org/3/library/abc.html#abc.ABCMeta
object.__init_subclass__()
https://docs.python.org/3/reference/datamodel.html#object.__init_subclass__
msgspec.Struct
https://msgspec.dev/api.html#msgspec.Struct
¶
https://msgspec.dev/structs#disabling-garbage-collection
reference counting
https://en.wikipedia.org/wiki/Reference_counting
cyclic garbage collector
https://github.com/python/cpython/blob/main/InternalDocs/garbage_collector.md
msgspec.Struct
https://msgspec.dev/api.html#msgspec.Struct
performance boost
https://msgspec.dev/benchmarks.html#struct-gc-benchmark
Next Constraints
https://msgspec.dev/constraints.html
Previous Supported Types
https://msgspec.dev/supported-types.html
Sphinx
https://www.sphinx-doc.org/
@pradyunsg
https://pradyunsg.me
Furo
https://github.com/pradyunsg/furo
https://github.com/msgspec/msgspec
Structs
https://msgspec.dev/structs
Default Values
https://msgspec.dev/structs#default-values
Post-Init Processing
https://msgspec.dev/structs#post-init-processing
Field Ordering
https://msgspec.dev/structs#field-ordering
Class Variables
https://msgspec.dev/structs#class-variables
Type Validation
https://msgspec.dev/structs#type-validation
Pattern Matching
https://msgspec.dev/structs#pattern-matching
Equality and Order
https://msgspec.dev/structs#equality-and-order
Frozen Instances
https://msgspec.dev/structs#frozen-instances
Tagged Unions
https://msgspec.dev/structs#tagged-unions
Omitting Default Values
https://msgspec.dev/structs#omitting-default-values
Forbidding Unknown Fields
https://msgspec.dev/structs#forbidding-unknown-fields
Renaming Fields
https://msgspec.dev/structs#renaming-fields
Encoding/Decoding as Arrays
https://msgspec.dev/structs#encoding-decoding-as-arrays
Runtime Definition
https://msgspec.dev/structs#runtime-definition
Advanced
https://msgspec.dev/structs#advanced
Metaclasses
https://msgspec.dev/structs#metaclasses
Disabling Garbage Collection
https://msgspec.dev/structs#disabling-garbage-collection
Viewport: width=device-width, initial-scale=1
URLs of
crawlers that visited me
.