
Jan. 15, 2021
7:30 p.m.
On Fri, Jan 15, 2021 at 18:15 Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
On 16/01/21 2:09 pm, Guido van Rossum wrote:
Yeah, that wasn't very clear, and I'm not 100% sure I got it right. But consider this: ``` class Outer: foo = 1 class Inner: print(foo)
That's true. So maybe the user should have to be explicit in cases like this:
class Outer: class Inner: def f(x: Outer.Inner): ...
However, I think cases like this should work:
class C: t = List[int] def f(x: t): ...
even though the closure placed in C.__co_annotations__ wouldn't normally have access to t without qualification.
Yes, the immediately surrounding scope should be accessible for annotations even if it’s a class.
--
--Guido (mobile)