-
-
Notifications
You must be signed in to change notification settings - Fork 519
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
Remove Sequence test in span #12541
Comments
comment:2
Some linear algebra results come back as Sequence objects, so maybe that's the reason. But you are right, it doesn't seem to matter. With patch:
Running tests right now. |
comment:3
Looks like the new test is missing one line of output. Doesn't it need a starting line for the error message |
comment:4
It certainly does! While fixing it, I noticed the same construction in another place, so I fixed it everywhere in this file. |
comment:5
On a related note: how about I will try to rewrite these functions in such a way, that they are happy with any iterable? I have a class at #11400 which wraps tuple without inheritance and it would be nice if it worked with spans, but adding another class to |
comment:6
Replying to @novoselt:
That sounds like a good idea. I've never been too excited about Sequence, I think it does a lot of work to get a common parent (which can be useful, but is often overkill). I'm going to give this a positive review, it passes all tests. Documentation looks good (except on my 5.0.beta1 I don't have the new trac/sphinx role). So maybe further improvements can go on another ticket? If so, cc me on it, even though things are going to get hectic again for me. Rob |
Reviewer: Rob Beezer |
This comment has been minimized.
This comment has been minimized.
comment:9
Sorry Rob, how about this alternative patch? It affects mostly the same lines, but instead of removing
If you agree with my reasons, I'd rather use this solution. |
comment:10
I've posted my current work in progress at #12544 - to make it work, I either need the alternative patch here, or tweak |
comment:11
Replying to @novoselt:
Understood. Super-busy for a few days. Feel free to ping me if this slips, but I'll try to look at it later this week. Rob |
This comment has been minimized.
This comment has been minimized.
comment:12
Ping! Do I understand correctly that there's a consensus to use this second patch, but that it hasn't yet been reviewed? Apply trac_12541_decrease_span_typechecking.patch (for the patchbot). |
comment:13
Replying to @loefflerd:
Yes I want to merge the second patch, feel free to review it ;-) It should be easy, provided that you agree with the idea of the change. To see the problems that this patch solves, you can play with #12544 without this one. |
comment:14
I find the error message in the doctest still somewhat cryptic. Here's a simplified explanation of what happens:
It appears that the span() function in free_module.pyx mostly tries to find an appropriate parent for the generators, and then hands everything off to the .span() method of the parent. So here, the integer zero is construed to be the first generator, and the class of integers has no span method. What do you think of checking if the first generator is a list, or if it is a free module element ( |
Now with a doctest |
comment:15
Attachment: trac_12541_decrease_span_typechecking.patch.gz OK, I've rewritten span function a bit to catch more issues and eliminate isinstance. Seems to work fine although I didn't run full tests yet. |
comment:16
All tests pass on beta8 with the new version! |
comment:17
Replying to @novoselt:
I like the looks of the new version. I did discover one problem.
I think this can be fixed by passing I might write a few more doctests for the span() function as part of final testing for this. |
comment:18
I knew about this behaviour and was sure that this is intended. What we have in your example is a an integral span of elements of a rational vector space. I suspect I may have even used it somewhere. So if you think that it has to be changed, perhaps we should discuss it on sage-devel first. In any case it seems orthogonal to this ticket which does the fix that I need for #12544, improves error messages from span, and did not affect the above behaviour. So I still propose merging the current version ;-) |
comment:19
The first test in the documentation actually shows integral span of rational vectors, so I really think that this was intended... |
comment:20
Replying to @novoselt:
OK, that makes sense, and I see the test that allows this. Misunderstanding on my part. But something more explicit in the documentation about this would help. How about
|
comment:21
Passes all tests and is a big improvement. So positive review. There are still a few scenarios which give semi-cryptic error messages, so I think there is still room for impovement in this constructor. |
comment:22
Documentation is going up on #12688 (wrong ticket on comment 20, which I just edited). |
Changed keywords from none to rd2 |
comment:24
Thank you! And thanks for pointing out that comments are editable now! |
Merged: sage-5.0.beta10 |
In Sage-5.0.beta4:
Such a command is likely to be a mistake, but the error message is irrelevant and is triggered by using a function name
Sequence
inisinstance
. The attached patch removes this test as sequences are instances of lists and are correctly recognized anyway.Apply:
attachment: trac_12541_decrease_span_typechecking.patch
CC: @rbeezer
Component: linear algebra
Keywords: rd2
Author: Andrey Novoseltsev
Reviewer: Rob Beezer
Merged: sage-5.0.beta10
Issue created by migration from https://trac.sagemath.org/ticket/12541
The text was updated successfully, but these errors were encountered: