sagemath / sagecell

The Sage Cell Server---providing a way to embed Sage computations into any web page.
Other
201 stars 70 forks source link

discrepancy in how iterators are handled #533

Closed kcrisman closed 4 years ago

kcrisman commented 4 years ago

The following code works in CoCalc

@interact
def taylor_polynomial(order=slider(range(1,13))):
    print(order)

But in Sage cell, you have to make the range into a list first. My guess is that maybe around https://github.com/sagemath/sagecell/blob/master/interact_compatibility.py#L45 one could do another check, or maybe if instead of

if isinstance(vmin, list):

it should check whether it is something iterable and then act accordingly.

Thoughts? I may be misinterpreting this.

novoselt commented 4 years ago

It works now after 461137570091ac4a7bfa5dce9d69d82b5bb3920a thanks for digging in and working on it!

kcrisman commented 4 years ago

@novoselt great, thanks! One thing - why did you delete the documentation? I don't think it was wrong. This just extends it to a use case that had worked in the past that Python (not Sage) changed.

novoselt commented 4 years ago

I've removed one of two copies of documentation, should have made a separate commit ;-)

kcrisman commented 4 years ago

I've removed one of two copies of documentation, should have made a separate commit ;-)

Haha, yes! Actually I remember seeing one of those duplicates, forgot to remind you of that but I guess you found it on your own :)