Home

PointPartialTypedDict

PointPartialTypedDict is a named dictionary type used in Python typing to describe a Point object where the coordinate fields may be omitted. It is commonly employed in type checking to model partial data, such as incremental construction, partial updates, or loosely specified API payloads.

In standard Python typing, a PointPartialTypedDict is typically defined as a TypedDict with optional keys. The

class PointPartialTypedDict(TypedDict, total=False):

x: float

y: float

With this definition, dictionaries like {} , {"x": 1.0}, {"y": 2.0}, or {"x": 1.0, "y": 2.0} are all

Since Python 3.11, the typing module supports NotRequired for more precise partial typing via PEP 655. This

from typing import TypedDict, NotRequired

class PointPartialTypedDict(TypedDict):

x: NotRequired[float]

y: NotRequired[float]

Use cases include functions that accept partial coordinates for updates or validation routines that tolerate missing

See also: TypedDict, NotRequired, PEP 655, typing_extensions.

traditional
approach
uses
total=False
to
make
all
declared
keys
optional.
For
example,
a
PointPartialTypedDict
with
optional
x
and
y
coordinates
can
be
defined
as:
valid
as
PointPartialTypedDict
values.
allows
explicitly
marking
individual
keys
as
optional
while
others
remain
required.
For
example:
fields.
Limitations
include
varying
level
of
support
across
static
type
checkers
and
Python
versions;
older
environments
may
rely
on
total=False,
while
newer
environments
can
leverage
NotRequired
for
finer
control.