On Fri, Jan 15, 2021 at 18:15 Greg Ewing <greg.ew...@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)
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/Y3NLHU4GP6FBVZPGU3NDGN3S3MUEJUMD/ Code of Conduct: http://python.org/psf/codeofconduct/