Skip to content

Commit d6a6955

Browse files
committed
Replaced comments with string literals
fixes python#35
1 parent 3a2d9f5 commit d6a6955

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

pep-0484.txt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,9 @@ hinting, use the following:
260260

261261
* a ``@no_type_checks`` decorator on classes and functions
262262

263-
* a ``# type: ignore`` comment on arbitrary lines
263+
* a ``'''type: ignore'''`` string literal on arbitrary lines
264264

265-
.. FIXME: should we have a module-wide comment as well?
265+
.. FIXME: should we have a module-wide string literals as well?
266266

267267

268268
Type Hints on Local and Global Variables
@@ -272,14 +272,16 @@ No first-class syntax support for explicitly marking variables as being
272272
of a specific type is added by this PEP. To help with type inference in
273273
complex cases, a comment of the following format may be used::
274274

275-
x = [] # type: List[Employee]
275+
'''type: List[Employee]'''
276+
x = []
276277

277278
In the case where type information for a local variable is needed before
278279
if was declared, an ``Undefined`` placeholder might be used::
279280

280281
from typing import Undefined
281-
282-
x = Undefined # type: List[Employee]
282+
283+
'''type: List[Employee]'''
284+
x = Undefined
283285
y = Undefined(int)
284286

285287
If type hinting proves useful in general, a syntax for typing variables
@@ -327,9 +329,12 @@ generics and union types:
327329
* TypeVar, used as ``X = TypeVar('X', Type1, Type2, Type3)`` or simply
328330
``Y = TypeVar('Y')``
329331

330-
* Undefined, used as ``local_variable = Undefined # type: List[int]`` or
331-
``local_variable = Undefined(List[int])`` (the latter being slower
332-
during runtime)
332+
* Undefined, used as ``local_variable = Undefined(List[int])`` or::
333+
334+
'''type: List[int]'''
335+
local_variable = Undefined
336+
337+
(the former being slower during runtime)
333338

334339
* Callable, used as ``Callable[[Arg1Type, Arg2Type], ReturnType]``
335340

0 commit comments

Comments
 (0)