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

Badly formed error messages for ModularFormsRing constructor #15037

Closed
itaibn mannequin opened this issue Aug 12, 2013 · 13 comments
Closed

Badly formed error messages for ModularFormsRing constructor #15037

itaibn mannequin opened this issue Aug 12, 2013 · 13 comments

Comments

@itaibn
Copy link
Mannequin

itaibn mannequin commented Aug 12, 2013

When you give the ModularFormsRing constructor invalid input, it returns a badly formed error message, as follows:

sage: ModularFormsRing(3.4)                                      
...
ValueError: Group (=%s) should be a congruence subgroup
sage: ModularFormsRing(Gamma0(2), base_ring=PolynomialRing(ZZ,x))
...
ValueError: Base ring (=%s) should be QQ, ZZ or a finite prime field

Component: modular forms

Author: John Cremona

Reviewer: Frédéric Chapoton

Merged: sage-5.12.beta4

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

@itaibn itaibn mannequin added this to the sage-5.12 milestone Aug 12, 2013
@itaibn itaibn mannequin added c: modular forms labels Aug 12, 2013
@JohnCremona
Copy link
Member

applies to 5.12.beta1

@JohnCremona
Copy link
Member

comment:1

Attachment: trac_15037-modular.patch.gz

The patch fixes the problem and adds two doctests.

@JohnCremona
Copy link
Member

Author: John Cremona

@fchapoton
Copy link
Contributor

Reviewer: Frédéric Chapoton

@fchapoton
Copy link
Contributor

comment:2

Attachment: trac_15037_review.patch.gz

here is a review patch. You can set the ticket to positive review if you agree with my changes.

@JohnCremona
Copy link
Member

comment:3

Replying to @fchapoton:

here is a review patch. You can set the ticket to positive review if you agree with my changes.

OK, I am happy (though no more happy than I was before! Is it stated somewhere that the % sign should have spaces around it? If so I will obey in future!)

@fchapoton
Copy link
Contributor

comment:4

well, this is the pep8 standard:

http://www.python.org/dev/peps/pep-0008/

and it is recommended for sage:

http://www.sagemath.org/doc/developer/conventions.html

@jdemeyer
Copy link

comment:6

Sorry to nitpick, but those exceptions should probably be TypeError, not ValueError (feel free to ignore this comment, it's not that important anyway).

@JohnCremona
Copy link
Member

comment:7

I could easily change that, and at the same time include chapoton's 4 spaces into my patch, but are you sure? If I give a ring as base_ring which happens not to be one of the rings allowed, that is surely an error in its Value not its Type?

@jdemeyer
Copy link

comment:8

Replying to @JohnCremona:

I could easily change that, and at the same time include chapoton's 4 spaces into my patch, but are you sure? If I give a ring as base_ring which happens not to be one of the rings allowed, that is surely an error in its Value not its Type?

Well a ring like RR is really a type which is not allowed, so that would be clearly a TypeError. Perhaps you could argue that GF(9) should be a ValueError since it's a finite field (an allowed type) but with the wrong number of elements. But for simplicity, I think a TypeError there would be okay. Technically speaking, even GF(3) and GF(9) are different Python types, so the TypeError in all cases is certainly defensible:

sage: type(GF(3))
<class 'sage.rings.finite_rings.finite_field_prime_modn.FiniteField_prime_modn_with_category'>
sage: type(GF(9,'a'))
<class 'sage.rings.finite_rings.finite_field_givaro.FiniteField_givaro_with_category'>

@JohnCremona
Copy link
Member

comment:9

OK -- but I don't think anyone seeing the error message would be very concerned over this distinction!

@jdemeyer
Copy link

comment:10

Replying to @JohnCremona:

OK -- but I don't think anyone seeing the error message would be very concerned over this distinction!

Of course, I clearly said in [comment:6] that it wasn't an important thing, just something I felt I should mention.

@jdemeyer
Copy link

Merged: sage-5.12.beta4

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

3 participants