[Python-ideas] TypeHinting: From variable name to type

Kyle Lahnakoski klahnakoski at mozilla.com
Sun Oct 21 12:08:02 EDT 2018



On 2018-10-21 10:44, David Mertz wrote:
> On Fri, Oct 19, 2018 at 3:18 AM Thomas Güttler
> <guettliml at thomas-guettler.de <mailto:guettliml at thomas-guettler.de>>
> wrote:
>
>     Now my idea: Per module and/or per file type hinting from variable
>     name.
>     Maybe a magic docstring in the __init__.py file:
>     variable-name-mapping:
>       {
>         request: django.http.HttpRequest,
>     }
>
>
> In general, I like this idea; but really only on a per-file basis.  A
> short header at the top would be easy enough for an IDE or linter to
> scan.  But imposing the conventions project-wide feels too broad.
>

Maybe in a .editorconfig file?  This would allow type hinting at a
number of directory levels.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20181021/137600e4/attachment.html>


More information about the Python-ideas mailing list