Opened 4 years ago

Last modified 4 years ago

#22703 new enhancement

proper polymake preferences, perhaps using Python 'with'

Reported by: mkoeppe Owned by:
Priority: major Milestone: sage-8.0
Component: interfaces Keywords: days84
Cc: SimonKing Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #22452 Stopgaps:

Status badges

Description (last modified by mkoeppe)

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

Change History (2)

comment:1 in reply to: ↑ description Changed 4 years ago by SimonKing

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.

Last edited 4 years ago by SimonKing (previous) (diff)

comment:2 Changed 4 years ago by mkoeppe

  • Dependencies set to #22452
  • Description modified (diff)
Note: See TracTickets for help on using tickets.