[Python-Dev] PEP 526 ready for review: Syntax for Variable and Attribute Annotations

Guido van Rossum guido at python.org
Thu Sep 1 16:25:17 EDT 2016


On Thu, Sep 1, 2016 at 10:01 AM, Koos Zevenhoven <k7hoven at gmail.com> wrote:
> On Thu, Sep 1, 2016 at 5:46 PM, Guido van Rossum <guido at python.org> wrote:
>> IOW, PEP 3157 is not dead yet. Indeed.
>>
>
> PEP 3157? Is that a typo or is there such a thing somewhere?

Sorry, 3107 (the original Function Annotations PEP).

> [...]
> I hope there will at least be a recommendation somewhere (PEP 8?) to not
> mix the two styles of attribute annotation (beginning of class / in
> method). The whole readability benefit turns against itself if there
> are some non-ClassVar variables annotated outside __init__ and then
> the rest somewhere in __init__ and in whatever initialization helper
> methods __init__ happens to call.

Yeah, but then again, in general I don't believe you can legislate the
writing of readable code using crude syntactic means. Not mixing the
two in the same class sounds like pretty good advice though, and a
linter should be able to catch that easily.

-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-Dev mailing list