-
-
Notifications
You must be signed in to change notification settings - Fork 482
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
Move the last few module classes from Module_old to Module #17543
Comments
Dependencies: #10513 |
This comment has been minimized.
This comment has been minimized.
Branch: u/pbruin/17543-Module_old |
Author: Peter Bruin |
Commit: |
Changed keywords from module to module coercion |
comment:4
Replying to @videlec:
I think it is best to wait until #10513 is merged. |
Branch pushed to git repo; I updated commit sha1. Last 10 new commits:
|
comment:6
After resolving the merge conflicts for #10513 there was only one left on this ticket. |
comment:7
Hi Peter, I do only have very minor points. This error message is not very nice
I would rather be more explicit
(I notice that you are not responsible for that) Why did you create the method diff --git a/src/sage/structure/gens_py.py b/src/sage/structure/gens_py.py
index c272503..e22a8a2 100644
--- a/src/sage/structure/gens_py.py
+++ b/src/sage/structure/gens_py.py
@@ -52,7 +52,7 @@ def abelian_iterator(M):
yield M(0)
return
- stop = list(M.generator_orders())
+ stop = [g.additive_order() for g in G]
for i in range(len(stop)):
if stop[i] is infinity:
raise ArithmeticError("%s is not finite."%M) not for this ticketDo you know why
What do you think? what |
comment:9
Replying to @videlec:
Even better: |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:11
Replying to @videlec:
I changed to
Good idea; I changed this as you suggested. Maybe
Yes, it would certainly makes more sense for it to be there.
Probably because it is only used in |
comment:13
Replying to @pjbruin:
Caveat: In Python, exception paths can end up being pretty common. For instance, the coercion framework will frequently use "leap before you look", relying on catching the exception if that happens. With the line above you can end up with expensive strings processing in a situation where the string never gets displayed. I haven't checked whether that's actually the case for this string and it's a reason to be conservative with constructing complicated error strings. An alternative (if it's necessary) is to use "lazy" strings, where the string reps of the constituents are only asked if the "lazy string" itself is asked for its representation. (mind you, our current object for this, |
comment:14
Two patchbots are not happy but for no serious reason. The strangely failing doctest on eddy is perfectly fine on my computer. Good to go! Vincent |
Reviewer: Vincent Delecroix |
comment:15
Replying to @nbruin:
Would be cool that string formatting to be fast and uniformized in errors. Why Python does not have a native solution for that?! Right now, I do prefer clear error messages instead of potentially faster coercion discovery. Vincent |
comment:16
Replying to @videlec:
I was wrong in my timing. The difference is considerable even here. Taking one of the examples from the documentation:
I think you should consider putting LazyFormat in the error messages (it's basically a drop-in replacement) or argue that the relevant error messages are only constructed with really cheap arguments in time-critical situations, or that these error messages never get raised in time-critical situations. |
comment:17
Note that a few years ago I introduced a lazy attribute error to be used in We did some experiments whether lazy strings could achieve the same, but they couldn't compete. However, what we did there was restricted to attribute errors. In any case, I agree that lazy error messages would be an improvment in the current situation. |
comment:18
Replying to @simon-king-jena:
I'd imagine that's faster, but it also has different semantics: if you have a traceback in which several such error messages occur, you'd have inaccurate information. The |
comment:19
I ran all doctests in --- a/src/sage/modular/abvar/finite_subgroup.py
+++ b/src/sage/modular/abvar/finite_subgroup.py
@@ -651,6 +651,7 @@ class FiniteSubgroup(Module):
z = self.abelian_variety().vector_space()(x, check=check)
if z in self.lattice():
return self.element_class(self, z, check=False)
+ print('raising complicated error')
raise TypeError("cannot convert {!r} into {}".format(x, self))
This shows that the error is only thrown in the doctest of |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:21
The latest commit simplifies |
comment:22
I'm okay with your latest round of changes. I moved some of the documentation around and added some extra (long) doctests. I'd be happy setting this to positive review as it currently stands (up to someone checking my changes). New commits:
|
Changed reviewer from Vincent Delecroix to Vincent Delecroix, Travis Scrimshaw |
Changed branch from u/pbruin/17543-Module_old to u/tscrim/module_old-17543 |
comment:23
Replying to @tscrim:
OK, thanks! |
Changed branch from u/tscrim/module_old-17543 to |
After #10513, only the following module classes still inherit from
Module_old
, which is being deprecated:sage.modular.abvar.finite_subgroup.FiniteSubgroup
sage.modular.overconvergent.genus0.OverconvergentModularFormsSpace
sage.structure.formal_sum.FormalSums
The goal of this ticket is to make these classes inherit from
Module
instead, to make them use the new coercion model, and to add a deprecation warning toModule_old
.Depends on #10513
CC: @jpflori @simon-king-jena
Component: commutative algebra
Keywords: module coercion
Author: Peter Bruin
Branch/Commit:
c3356eb
Reviewer: Vincent Delecroix, Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/17543
The text was updated successfully, but these errors were encountered: