Giter VIP home page Giter VIP logo

Comments (5)

Stewori avatar Stewori commented on August 14, 2024

Regarding this article http://wphomes.soic.indiana.edu/jsiek/what-is-gradual-typing/, what would ? be? Any or T?
I'm not sure I ever considered unbound type variables as an explicitly valid use case for is_subtype. I think I handled them to allow checking of partly bound types.
That said, if is_consistent_with only differs from is_subtype by additional rules for Any that feature would be trivial to add and I'd happily do. (Implementing a proper is_subtype is the highly non-trivial thing here.) As you observed, for is_subtype Any is never a subtype except of itself.

from pytypes.

udim avatar udim commented on August 14, 2024

? in the article you mentioned would be Any in my example.

I believe that the only difference between the is_consistent_with and is_subtype relationships is that is_consistent_with has that special rule for Any that always returns true regardless if it's on the LHS or RHS.

from pytypes.

Stewori avatar Stewori commented on August 14, 2024

If you like, write a PR for this. It shouldn't be too difficult, would safe me some work and you would be appropriately credited in the project history. Otherwise I'll see when I can add this...

from pytypes.

udim avatar udim commented on August 14, 2024

I can write the PR, no problem. I've already hacked my local copy of pytypes and it seems to work.

However, I am still investigating typing module types in Python 3.x to see if they can be used in our project. (Today's wrinkle is pickling, which seems to be broken for 3.5 and 3.6. python/typing#511)

from pytypes.

Stewori avatar Stewori commented on August 14, 2024

Regarding pickling, maybe a solution by pytypes on this front is type_str. It creates a string representation of a type such that the type can be trivially reconstructed using eval. There are some pitfalls though: Imports must be sufficient and of course using eval requires a trusted source. Also, it might not support every type yet.

from pytypes.

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.