-
-
Notifications
You must be signed in to change notification settings - Fork 553
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
moving _repr_fixups list from doctest/parsing.py header to method do_fixup #33680
Comments
Dependencies: #33588 |
Commit: |
New commits:
|
Branch: u/slabbe/33680 |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:7
Seems to need rebasing. |
comment:10
Probably due to #34533? |
Changed dependencies from #33588 to none |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:13
I solved the conflict. The interest in the current ticket is that it is more readable and testable when fixing an issue. For instance, new doctests could be added in the |
comment:14
As an overarching issue, I don't understand why so many regular expressions are defined at the top level in Anyway, for this ticket, should we move |
comment:15
I like the change, in any case. |
comment:16
I can push a change that moves all of the regular expressions out of the top level, if you would like. |
comment:17
Replying to John Palmieri:
I wonder if the reason is the following. Even if it is used only once in the file, the method can be called many times (for instance when doctesting the entire sage library), so that the compilation of the regex will be done only once and not thousands of times. What do you think? |
comment:18
Replying to Sébastien Labbé:
That's possible, but I didn't see any difference in timings. See https://stackoverflow.com/questions/452104/is-it-worth-using-pythons-re-compile/452143#452143 for a little analysis that reaches the conclusion that it doesn't save time to compile. I found the discussion at https://stackoverflow.com/questions/452104/is-it-worth-using-pythons-re-compile helpful in general. It seems that Python internally compiles and caches regular expressions anyway, so this shouldn't be saving us time, and in my observations it isn't. So I think we can make the decision based on what makes the code most readable. See also the note here: https://docs.python.org/3/library/re.html#re.compile. This is all talking about compiling vs. not, but I think the same applies to where the compile statements are in the code. |
comment:20
I agree, I just did a commit doing that. |
comment:21
Looks good to me. |
Reviewer: John Palmieri |
Changed branch from u/slabbe/33680 to |
As a follow-up of #33588 where we suggested in comment:10 to move out of context
_repr_fixups
list from the header ofdoctest/parsing.py
to the methoddo_fixup
.CC: @fchapoton @jhpalmieri @kiwifb
Component: doctest framework
Author: Sébastien Labbé
Branch/Commit:
5b539c5
Reviewer: John Palmieri
Issue created by migration from https://trac.sagemath.org/ticket/33680
The text was updated successfully, but these errors were encountered: