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

Code Executor Fails to Preserve Context Between Code Blocks #101

Open
g1ronn1mo opened this issue Sep 9, 2024 · 0 comments
Open

Code Executor Fails to Preserve Context Between Code Blocks #101

g1ronn1mo opened this issue Sep 9, 2024 · 0 comments

Comments

@g1ronn1mo
Copy link

Hello,

I would like to address a concern regarding the behavior of the code executor, which significantly impacts the user experience when writing and running code.

Unlike in Jupyter Notebooks, where the context (i.e., variables, functions, and objects) is preserved between the execution of separate code blocks, the current code executor does not remember the state of the environment between code blocks. This means that when running consecutive blocks of code, I am forced to redefine variables, import libraries, or redo calculations in every block, leading to a less efficient workflow.

Example Scenario:

In Jupyter Notebook:

  1. Define a variable in one code block:
    x = 10
  2. Use that variable in another block without redefining it:
    print(x)  # Outputs 10

In the current code executor:

  1. Define a variable in one code block:
    x = 10
  2. Running another block that references x will result in an error, as the context is not preserved:
    print(x)  # Error: 'x' is not defined

Impact:

This lack of context preservation hinders productivity by making it harder to run iterative experiments or split complex logic into smaller, manageable pieces across multiple code blocks. The user is forced to re-run all previous blocks to restore the context, which defeats the purpose of breaking code into multiple parts and reduces the overall usability of the executor.

Desired Behavior:

The ideal scenario would be to have the code executor preserve the state across multiple blocks, similar to how Jupyter Notebooks operate. This would allow users to work with a more efficient, iterative workflow where previous code is remembered and available for subsequent blocks, improving the user experience for anyone writing code.

Thank you for considering this suggestion. I hope this can be addressed in future updates, as it will greatly enhance the functionality of the tool for users.

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