Skip to content

Commit 1ba67e9

Browse files
committed
fix some grammar typos and build
1 parent bd36a62 commit 1ba67e9

File tree

1 file changed

+12
-32
lines changed

1 file changed

+12
-32
lines changed

peps/pep-0718.rst

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -201,28 +201,9 @@ The following code snippet would fail at runtime without this change as
201201
Interactions with ``@typing.overload``
202202
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
203203

204-
Overloaded functions should work much the same as already, since they have no effect on
205-
the runtime type. This change will lead to more expressiveness with user's able to
206-
decide and the behaviour/overload can be specified by the developer rather than leaving
207-
it to ordering of overloads/unions.
208-
209-
.. code-block:: python
210-
211-
# N.B. `class bytes(Sequence[int]): ...` and `Foo` is a non-specified generic type
212-
@overload
213-
def seq_first[T: Sequence[int]](x: T) -> T: ...
214-
@overload
215-
def seq_first[T: bytes](x: T) -> Foo[T]: ...
216-
217-
@overload
218-
def bytes_first[T: bytes](x: T) -> Foo[T]: ...
219-
@overload
220-
def bytes_first[T: Sequence[int]](x: T) -> T: ...
221-
222-
reveal_type(seq_first(b"")) # type is bytes
223-
reveal_type(bytes_first(b"")) # type is Foo[bytes]
224-
225-
Explicit specialisation will restrict the set of available overloads
204+
Overloaded functions should work much the same as they already do, since they do not
205+
affect the runtime type. Explicit specialisation will restrict the set of available
206+
overloads.
226207

227208
.. code-block:: python
228209
@@ -232,33 +213,32 @@ Explicit specialisation will restrict the set of available overloads
232213
def make(x: str, y: str) -> tuple[int, int]: ...
233214
234215
reveal_type(make[int](1)) # type is int
235-
reveal_type(make[int]("foo", "bar")) # Invalid: no overload for `make[int](x:str, y: str)` found, a similar overload exists but explicit specialisation prevented its use
216+
reveal_type(make[int]("foo", "bar")) # Invalid: no overload for `make[int](x: str, y: str)` found, a similar overload exists but explicit specialisation prevented its use
236217
237218
Functions Parameterized by ``TypeVarTuple``\ s
238219
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
239-
Currently type checkers disallow the use of multiple ``TypeVarTuple`` \s in it's
240-
generic parameters, however it is currently valid to have a function as such
220+
Currently, type checkers disallow the use of multiple ``TypeVarTuple``\s in their
221+
generic parameters; however, it is currently valid to have a function as such:
241222

242223
.. code-block:: python
243224
244225
def foo[*T, *U](bar: Bar[*T], baz: Baz[*U]): ...
245226
def spam[*T](bar: Bar[*T]): ...
246227
247-
This PEP does not allow similar functions to be subscripted, for the same reason as
248-
defined in :pep:`PEP 646<646#multiple-type-variable-tuples-not-allowed>`.
228+
This PEP does not allow functions like ``foo`` to be subscripted, for the same reason
229+
as defined in :pep:`PEP 646<646#multiple-type-variable-tuples-not-allowed>`.
249230

250231
.. code-block:: python
251232
252233
foo[int, str, bool, complex](Bar(), Baz()) # Invalid: cannot determine which parameters are passed to *T and *U. Explicitly parameterise the instances individually
253234
spam[int, str, bool, complex](Bar()) # OK
254235
255-
256236
Binding Rules
257237
^^^^^^^^^^^^^
258-
Subscriptions on methods (including classmethods, staticmethods etc.) should only have
259-
access to their function's type parameters and not the enclosing class's. Subscription
260-
should follow the rules specified in :pep:`PEP 696<696#binding-rules>` methods should
261-
be bound on attribute access.
238+
Method subscription (including ``classmethods``, ``staticmethods``, etc.) should only
239+
have access tos their function's type parameter and not the enclosing class's.
240+
Subscription should follow the rules specified in :pep:`PEP 696<696#binding-rules>`;
241+
methods should bind type parameters on attribute access.
262242

263243
.. code-block:: python
264244

0 commit comments

Comments
 (0)