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
New syntax for GlobalOptions #23238
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
comment:4
Not having the global options doc-tested seems to be causing problems, and all documentation should be doc-tested, so I think that this is a good idea. This said, I am surprised that there is testable code hidden in the global options that is not doc-tested elsewhere: tests for all methods should be given in the methods. For what it's worth, my initial plan was to write the options as a class but one of the people I discussed this with thought that creating a class for each set of options was a little OTT. |
This comment has been minimized.
This comment has been minimized.
Commit: |
comment:7
This is an early prototype. Pickling is not yet supported and it needs a lot more tests and docs. New commits:
|
Dependencies: #23277 |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
This comment has been minimized.
This comment has been minimized.
Changed dependencies from #23277 to none |
This comment has been minimized.
This comment has been minimized.
comment:14
Overall I like the improved way to create global options as classes. However, I do not like how I would prefer I'm also not sure about the change to actually print the |
comment:15
Replying to @tscrim:
I don't get what you mean with this.
We could escape
Right. So maybe keep the doc as before but add tests too. |
comment:16
Replying to @jdemeyer:
Class attributes and instance attributes behave in exactly the same way: sage: class Foo(object):
....: bar = 5
....: def __init__(self):
....: self.var = -1
sage: f = Foo()
sage: f.bar
5
sage: f.var
-1
sage: f.bar = 2
sage: f2 = Foo()
sage: f2.bar
5
sage: f.bar
2 So having the class level attribute of
Exactly my conclusion. This comment ended up being more of a conversion with myself. Sorry, I should've added that I don't think we should change anything.
I think this is the best way forward. |
comment:17
Replying to @tscrim:
I see what you mean but I don't see the relevance to this ticket.
To me, the I have also been considering |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:19
Replying to @jdemeyer:
Since this ticket is about setting the API for
Well, this goes to the statement I made about breaking encapsulation, but I want to make it part of the API in a way. At least since we don't have an
This also is good for me as it is clear it is special. I have a very mild preference for |
comment:20
Replying to @tscrim:
The Even if you consider the
In that case I will use |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Reviewer: Travis Scrimshaw |
comment:23
LGTM. Thank you. |
Changed branch from u/jdemeyer/change_syntax_of_globaloptions to |
Rethink the syntax of
GlobalOptions
. This is mainly meant to address the problem that thedoc
andend_doc
attributes of aGlobalOptions
object are not doctested (see #16693 and #18051 which were closed as duplicate of #14272 but which would better be fixed independently).I am thinking of replacing
by
In other words, to use the
class
statement purely as a custom syntax, but without actually creating a class. The main advantage of this syntax is that doctests are just ordinary doctests, there is no need fordoc=
andend_doc=
arguments.This ticket is about enabling the new syntax in addition to the old syntax. Converting the existing use-cases of
GlobalOptions
will be delegated to follow-up tickets.CC: @darijgr @dkrenn @AndrewAtLarge @tscrim
Component: misc
Author: Jeroen Demeyer
Branch/Commit:
94807eb
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/23238
The text was updated successfully, but these errors were encountered: