On Fri, 3 May 2019 at 01:36, Dominik Gabi <dkgispam@gmail.com> wrote:
Thanks for the write-up Sully. Two quick questions:

1. what’s the rationale for prohibiting `Final` in loops? I have a hunch this has to do with Python leaking scopes but not entirely sure. IIRC this is fine in Java.

In some sense yes. The point is that Python cycles don't create a separate scope, they just live entirely in the enclosing scope.
 
2.
> Type checkers should infer a final attribute that is initialized in a class body as being a class variable. Variables should not be annotated with both ClassVar and Final.

I’m probably missing something here but why not support something like `attribute: ClassVar[Final[int]]`? Isn’t this conflating two unrelated concepts?

The point here is that according to PEP 526 ClassVar is something that can't be _set_ on instances (only on class object itself). While it still can be _accessed_ on instances. So they are not entirely orthogonal, if something is `Final` (can't be set neither on instance nor on class) there is no point in annotating it as a ClassVar.

--
Ivan