Giter Club home page Giter Club logo

Comments (6)

ilevkivskyi avatar ilevkivskyi commented on May 28, 2024

But this would be a simple combination of get_args and get_origin. I think we should get better API for more general functions rather than focus on many specialized functions.

from typing_inspect.

Stewori avatar Stewori commented on May 28, 2024

Yet again there is something in pytypes I'd like to point out.
pytypes.get_iterable_itemtype might be of some help, not the entire solution to this request though.

from typing_inspect.

smarie avatar smarie commented on May 28, 2024

Thanks ! yes @ilevkivskyi you are right, but that might be a "frequent" specialized request. See the collections module: it is extremely useful, although specialized on collections. @Stewori I'll have a look

from typing_inspect.

Stewori avatar Stewori commented on May 28, 2024

@smarie it just occurred to me that pytypes.get_iterable_itemtype is only about iterable from collections, not about Iterable from typing. Regarding a generic subtype of Iterable from typing, pytypes also has a good (?) way to retrieve the item type, but that's not conveniently accessible via API right now IIRC. (We can maybe add such an API, it wouldn't be too hard using the already existing utilities. The question is more how such an API should exactly look like...)

from typing_inspect.

Stewori avatar Stewori commented on May 28, 2024

There are now functions in pytypes to accomplish this:

I suppose this essentially solves this issue, once the next pytypes version is released.

from typing_inspect.

ilevkivskyi avatar ilevkivskyi commented on May 28, 2024

OK, I think we can close this for now, since pytypes provide the functionality.

from typing_inspect.

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.