Author msullivan
Recipients gvanrossum, levkivskyi, msullivan
Date 2019-05-10.20:40:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1557520816.53.0.629625329103.issue36878@roundup.psfhosted.org>
In-reply-to
Content
Per discussion during the typing summit at PyCon, it would be a good idea to allow extra information to be included in `# type: ignore` comments, in order to allow behavior such as suppressing individual errors (for example, with syntax like `# type: ignore[E1000]`, to suppress error 1000).

My proposal, then, is to generalize the definition of type: ignore comments to be `# type: ignore followed by a non-alphanumeric character. Then `# type: ignore[E1000]` and `# type: ignore E1000` would be valid type ignore comments while `# type: ignoreE1000` would not be.

Now that ast.parse can parse type_comments, this needs to make it into 3.8, basically, if we want to do this and be able to use the ast type_comment feature.

Ideally, the text of the type ignore would be actually included in the produced AST. As a bare minimum first step, we need to recognize type ignores with extra information and report them (and, critically, not detect them as regular type comments and produce errors when they appear in unexpected places).

I'll put up a PR to do the second part shortly.
History
Date User Action Args
2019-05-10 20:40:16msullivansetrecipients: + msullivan, gvanrossum, levkivskyi
2019-05-10 20:40:16msullivansetmessageid: <1557520816.53.0.629625329103.issue36878@roundup.psfhosted.org>
2019-05-10 20:40:16msullivanlinkissue36878 messages
2019-05-10 20:40:15msullivancreate