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

catch ValueError in comparisons #13957

Closed
videlec opened this issue Jan 15, 2013 · 10 comments
Closed

catch ValueError in comparisons #13957

videlec opened this issue Jan 15, 2013 · 10 comments

Comments

@videlec
Copy link
Contributor

videlec commented Jan 15, 2013

When element construction by a parent raise a ValueError, it prevents using the coercion in comparisons.

Note: a coercion should not fail and there is no reason to catch a ValueError.

CC: @staroste @seblabbe @videlec

Component: coercion

Keywords: comparison

Reviewer: Vincent Delecroix

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

@videlec videlec added this to the sage-5.10 milestone Jan 15, 2013
@videlec videlec self-assigned this Jan 15, 2013
@videlec
Copy link
Contributor Author

videlec commented Jan 15, 2013

Attachment: trac_13957-catch_value_error.patch.gz

@seblabbe
Copy link
Contributor

comment:1

Can you add a doctest that illustrates the fix ?

@videlec
Copy link
Contributor Author

videlec commented Jan 15, 2013

comment:2

No... the only way I found is through a Cython class that inherits from Element. A concrete example is with finite words in #12224. I will look further.

@tscrim
Copy link
Collaborator

tscrim commented Feb 28, 2013

comment:4

Sebastien, did you do a review of the patch otherwise?

Best,

Travis

@seblabbe
Copy link
Contributor

seblabbe commented Mar 3, 2013

comment:5

Replying to @tscrim:

Sebastien, did you do a review of the patch otherwise?

Since I am not familiar with this, I would have prefer to do some test starting from a doctest, thus my question. So, no, I did not do any further review.

Sébastien

@tscrim
Copy link
Collaborator

tscrim commented May 25, 2013

comment:6

Replying to @videlec:

No... the only way I found is through a Cython class that inherits from Element. A concrete example is with finite words in #12224. I will look further.

I completely forgot about this ticket. Vincent, could you do a minimal/small example by doing the doctest something like

sage: cython("""
....: class Foo(Element):
....:     pass
....: """)
sage: Foo() == Foo()
sage: Foo() < Foo()

Thanks,

Travis

@videlec
Copy link
Contributor Author

videlec commented Jun 3, 2013

comment:7

Hi Travis,

I open the ticket because we made some stupid design decisions for #12224. The point was that we implement a coercion from lists to Words and we raised some ValueError if the content of the list does not match the alphabet. As I learn, it is definitely not what we want from a coercion: a coercion should always succeed.

I close it as wont fix.

@videlec
Copy link
Contributor Author

videlec commented Jun 3, 2013

Changed author from Vincent Delecroix to none

@videlec

This comment has been minimized.

@videlec videlec removed this from the sage-5.10 milestone Jun 3, 2013
@jdemeyer
Copy link

jdemeyer commented Jun 6, 2013

Reviewer: Vincent Delecroix

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

4 participants