Git Product home page Git Product logo

Comments (3)

mikeshardmind avatar mikeshardmind commented on June 20, 2024

I think this should be timed to when match when annotations are automatically lazily evaluated and after the last version where types in the standard library were not properly generic at runtime. Keep in mind things like asyncio.Queue cannot be subscripted at runtime in python 3.8, and array.array is not subscriptable at runtime until 3.12. Doing this prior to when 3.11 is no longer supported would be a problem

from typing.

srittau avatar srittau commented on June 20, 2024

I don't think this change should be dependent on lazy evaluation and generics in the stdlib. Lazy evaluation is already available in all supported Python versions through from __future__ import annotations and this also mostly fixes the missing generics problem. In cases where it doesn't, types can be quoted.

I don't see a remaining use case for type comments, except backwards compatibility.

from typing.

mikeshardmind avatar mikeshardmind commented on June 20, 2024

It doesn't fix this, as this will cause errors when people use tools that are also in the standard library to inspect annotations. Some of this kind of inspection of types at runtime has become popular enough that it's pretty common to be done by libraries for various reasons. There's not a way to properly handle some things in the standard library until at least 3.12 by my reckoning, and that's just based on the things I'm aware of. A stringified annotation is still supposed to be valid when eval'd, and typing.Annotated exists for non-type information.

from typing.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.