Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context managed code generation #42

Closed
ahopkins opened this issue Jun 21, 2021 · 0 comments
Closed

Context managed code generation #42

ahopkins opened this issue Jun 21, 2021 · 0 comments

Comments

@ahopkins
Copy link
Member

Re code generation: maybe take that a step forward and use actual inline Python code instead of string literals. Code that is syntactically valid can be loaded even if the variables don't exist, provided that the particular path never gets executed. Annotations or some other hacks could be used to inject parts into it. Well, you get the idea but this is becoming some true black magic by now.

# This is router code
if need_foo:
    with codegen:
        # This is generated code
        if route == "foo":
            return handler_foo

Originally posted by @Tronic in #37 (comment)

@ahopkins ahopkins changed the title Re code generation: maybe take that a step forward and use *actual* inline Python code instead of string literals. Code that is syntactically valid can be loaded even if the variables don't exist, provided that the particular path never gets executed. Annotations or some other hacks could be used to inject parts into it. Well, you get the idea but this is becoming some true black magic by now. Context managed code generation Jun 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant