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

proper polymake preferences, perhaps using Python 'with' #22703

Open
mkoeppe opened this issue Mar 28, 2017 · 3 comments
Open

proper polymake preferences, perhaps using Python 'with' #22703

mkoeppe opened this issue Mar 28, 2017 · 3 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Mar 28, 2017

Following up on #22452 (Create a Polymake pexpect interface):

Polymake's prefer is bad because it is too persistent, writing to a preference file.
We cannot use prefer_now directly because it is local to the current line.
We should have a way to set preferences local to a code block.
Perhaps a Python context manager (using the with keyword) would be the right solution.

See also: #22710: Meta-ticket: polymake

Depends on #22452

CC: @simon-king-jena

Component: interfaces

Keywords: days84

Issue created by migration from https://trac.sagemath.org/ticket/22703

@mkoeppe mkoeppe added this to the sage-8.0 milestone Mar 28, 2017
@simon-king-jena
Copy link
Member

Replying to @mkoeppe:

Polymake's prefer is bad because it is too persistent, writing to a preference file.
We cannot use prefer_now directly because it is local to the current line.
We should have a way to set preferences local to a code block.
Perhaps a Python context manager (using the with keyword) would be the right solution.

I agree that we don't want Sage to set preferences permanently (unless the user asks it). Although a "with" block may be a good solution for modules, I don't think that we want that in an interactive session.

So, I think ideally we would have a method polymake.preferences, so that

sage: polymake.preferences(...)

would set preferences that expire when the sage session ends, and

with polymake.preferences(...):
    many
    lines
    of
    code

would set preferences that expire when the "with" block ends.

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 30, 2017

Dependencies: #22452

@mkoeppe mkoeppe removed this from the sage-8.0 milestone Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants