Skip to content

Commit 7487d09

Browse files
committed
Have claude proofread the PEP
1 parent 9c47521 commit 7487d09

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

pep.rst

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ frameworks. The type system typically cannot model metaprogramming.
3333

3434
To bridge the gap between metaprogramming and the type
3535
system, some libraries come with custom mypy plugins (though then
36-
other typechecker suffer). The case of dataclass-like transformations
36+
other typecheckers suffer). The case of dataclass-like transformations
3737
was considered common enough that a special-case
3838
``@dataclass_transform`` decorator was added specifically to cover
3939
that case (:pep:`PEP 681 <681>`).
@@ -125,7 +125,7 @@ which would have return type ``list[<User>]`` where::
125125
email: str
126126
posts: list[<Post>]
127127

128-
class <Post>
128+
class <Post>:
129129
id: int
130130
title: str
131131
content: str
@@ -172,7 +172,7 @@ fields stripped), while ``HeroCreate`` and ``HeroUpdate`` serve as
172172
input types (automatically converted from JSON and validated based on
173173
the types, using `Pydantic <#pydantic_>`_).
174174

175-
Despite all multiple types and duplication here, mechanical rules
175+
Despite the multiple types and duplication here, mechanical rules
176176
could be written for deriving these types:
177177

178178
* Public should include all non-"hidden" fields, and the primary key
@@ -249,14 +249,14 @@ existing libraries do.
249249

250250
Make it possible for libraries to implement more of these patterns
251251
directly in the type system will give better typing without needing
252-
futher special casing, typechecker plugins, hardcoded support, etc.
252+
further special casing, typechecker plugins, hardcoded support, etc.
253253

254254
(Example code for implementing this :ref:`below <init-impl>`.)
255255

256256
More powerful decorator typing
257257
------------------------------
258258

259-
The typing of decorator functions has long been a pain point in python
259+
The typing of decorator functions has long been a pain point in Python
260260
typing. The situation was substantially improved by the introducing of
261261
``ParamSpec`` in :pep:`PEP 612 <612>`, but a number of patterns remain
262262
unsupported:
@@ -278,7 +278,7 @@ arrays, such as::
278278

279279
x: Array[float, L[480], L[640]] = Array()
280280

281-
The example in the that PEP shows how ``TypeVarTuple`` can be used to
281+
The example in that PEP shows how ``TypeVarTuple`` can be used to
282282
make sure that both sides of an arithmetic operation having matching
283283
shapes. Most multi-dimensional array libraries, however, also support
284284
broadcasting [#broadcasting]_, which allows the mixing of differently
@@ -350,7 +350,7 @@ from "PEP 646 – Variadic Generics".
350350

351351
When inferring types here, the type checker should be **aggressive in
352352
inferring literal types when possible**. (TODO: Or maybe we need to
353-
make that configurable in the ``TypedDict`` erving as the bound?)
353+
make that configurable in the ``TypedDict`` serving as the bound?)
354354

355355
This is potentially moderately useful on its own but is being done to
356356
support processing ``**kwargs`` with type level computation.
@@ -389,7 +389,7 @@ And then, we can represent the type of a function like::
389389
) -> int:
390390
...
391391

392-
as (we are omiting the ``Literal`` in places)::
392+
as (we are omitting the ``Literal`` in places)::
393393

394394
Callable[
395395
[
@@ -411,8 +411,8 @@ or, using the type abbreviations we provide::
411411
[
412412
PosParam["a", int],
413413
Param["b", int],
414-
DefaultParam["c", int,
415-
ArgsParam[int, "*"],
414+
DefaultParam["c", int],
415+
ArgsParam[int],
416416
NamedParam["d", int],
417417
NamedDefaultParam["e", int],
418418
KwargsParam[int],
@@ -498,10 +498,10 @@ used in the body of conditionals. They consist of the :ref:`Boolean
498498
Operators <boolean-ops>`, defined below, potentially combined with
499499
``and``, ``or``, ``not``, ``all``, and ``any``. For ``all`` and
500500
``any``, the argument is a comprehension of type booleans, evaluated
501-
in the same was as the :ref:`unpacked comprehensions <unpacked>`.
501+
in the same way as the :ref:`unpacked comprehensions <unpacked>`.
502502

503503
When evaluated, they will evaluate to ``Literal[True]`` or
504-
``Literal[False]]``.
504+
``Literal[False]``.
505505

506506
(We want to restrict what operators may be used in a conditional
507507
so that at runtime, we can have those operators produce "type" values
@@ -514,7 +514,7 @@ Conditional types
514514

515515
The type ``true_typ if bool_typ else false_typ`` is a conditional
516516
type, which resolves to ``true_typ`` if ``bool_typ`` is equivalent to
517-
``Literal[True]`` and to ``true_typ`` otherwise.
517+
``Literal[True]`` and to ``false_typ`` otherwise.
518518

519519
``bool_typ`` is a type, but it needs syntactically be a type boolean,
520520
defined above.
@@ -535,7 +535,7 @@ usual way.
535535
Type operators
536536
--------------
537537

538-
In some sections below we write things like ``Literal[int]]`` to mean
538+
In some sections below we write things like ``Literal[int]`` to mean
539539
"a literal that is of type ``int``". I don't think I'm really
540540
proposing to add that as a notion, but we could.
541541

@@ -572,7 +572,7 @@ Basic operators
572572

573573
N.B: Runtime evaluation will only be able to support proper classes
574574
as ``Base``, *not* protocols. So, for example, ``GetArg[Ty,
575-
Iterable, 0]]`` to get the type of something iterable will need to
575+
Iterable, 0]`` to get the type of something iterable will need to
576576
fail in a runtime evaluator. We should be able to allow it
577577
statically though.
578578

@@ -640,7 +640,7 @@ Object inspection
640640
* ``D`` is the defining class of the member. (That is, which class
641641
the member is inherited from. Always ``Never``, for a ``TypedDict``)
642642

643-
* ``MemberQuals = Literal['ClassVar', 'Final', 'NotRequired, 'ReadOnly']`` -
643+
* ``MemberQuals = Literal['ClassVar', 'Final', 'NotRequired', 'ReadOnly']`` -
644644
``MemberQuals`` is the type of "qualifiers" that can apply to a
645645
member; currently ``ClassVar`` and ``Final`` apply to classes and
646646
``NotRequired``, and ``ReadOnly`` to typed dicts
@@ -1209,7 +1209,7 @@ unbound type variables and let them be generalized::
12091209

12101210
The problem is that this is basically incompatible with runtime
12111211
evaluation support, since evaluating the alias ``Foo`` will need to
1212-
evalaute the ``IsSub``, and so we will lose one side of the
1212+
evaluate the ``IsSub``, and so we will lose one side of the
12131213
conditional at least. Similar problems will happen when evaluating
12141214
``Members`` on a class with generic functions. By wrapping the body
12151215
in a lambda, we can delay evaluation in both of these cases. (The
@@ -1350,7 +1350,7 @@ This proposal is less "strictly-typed" than typescript
13501350
Typescript has better typechecking at the alias definition site:
13511351
For ``P[K]``, ``K`` needs to have ``keyof P``...
13521352

1353-
We could do potentially better but it would require more meachinery.
1353+
We could do potentially better but it would require more machinery.
13541354

13551355
* ``KeyOf[T]`` - literal keys of ``T``
13561356
* ``Member[T]``, when statically checking a type alias, could be

0 commit comments

Comments
 (0)