Giter VIP home page Giter VIP logo

Comments (3)

vltr avatar vltr commented on July 24, 2024

I think for middle it would be a relatively simple change, but it is a 3.7+ change. Just a thought.

It may be simple, yes, but I intend to support Python 3.6 yet for middle 0.3.x. I know that middle uses some metaclass magic and perhaps I could workaround that, but I feel this would not be possible since middle evaluates the classes during declaration - or I could lazily evaluate them as they are registered and replacing the defined classes in runtime. Hmmm, this does need some testing to see if it can be done with Python 3.6 and would not break evaluation ...

from middle.

ahopkins avatar ahopkins commented on July 24, 2024

I have not tried it... but does middle accept string annotations?

class Foo:
    bars: List["Bar"]

from middle.

vltr avatar vltr commented on July 24, 2024

I have not tried it... but does middle accept string annotations?

Nope, a str is a str (for now). I was thinking about:

class Foo:
    bars: List[middle.lazy("Bar")]

Instead of the lazy annotations, but this will fall into the same problem as I mentioned earlier: lazily evaluate the entire class only when all classes are available and reload them inside sys.modules ... A bit hacky, I don't know if it'll work properly but it'll be almost the same thing as the metaclass making this magic (I guess).

from middle.

Related Issues (18)

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.