Opened 10 years ago

Closed 9 years ago

#14169 closed defect (duplicate)

Let %attach behave like the old attach, and provide a doctest for %attach

Reported by: Simon King Owned by: William Stein
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: user interface Keywords:
Cc: Merged in:
Authors: Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

Currently (sage-5.8.beta0), when using attach /path/to/file.pyx, one gets a deprecation warning and is told to use %attach instead of attach.

Problem: If one changes the file that is attached with %attach then no automatic re-compilation happens. But that would be the main point of attaching a file! And the automatic re-compilation used to be a feature of attach. Hence, changing from attach to %attach is a regression.

Moreover, it seems that %attach is not doc-tested.

Not clear if "user interface" is the right component, but attach is used in interactive sessions, after all...

Change History (7)

comment:1 Changed 10 years ago by Karl-Dieter Crisman

This is presumably due to #12719. Note that you can still use attach('foo.spyx'), apparently, without receiving the warning.

Would an acceptable solution be to change the deprecation warning to say that if you want the magic function, you will be using IPython's native attach, and if you want the recompiling, you can use Sage's version? I admit that doesn't sound appetizing to me, just brainstorming.

comment:2 Changed 10 years ago by Karl-Dieter Crisman

See also #14149.

comment:3 Changed 9 years ago by Hugh Thomas

The behaviour I am getting (using 5.9.beta1) is a little different than what was described originally. Suppose I attach a file using %attach. If I edit the file and hit return at the sage prompt, my file is not recompiled. But when I next enter anything non-trivial at the sage prompt (eg, 1+1), the file is recompiled.

So the behaviour is different from the old behaviour, and a bit surprising, but not entirely broken. That said, I still prefer the old behaviour.

Last edited 9 years ago by Hugh Thomas (previous) (diff)

comment:4 Changed 9 years ago by Hugh Thomas

It turns out this phenomenon was discussed at http://trac.sagemath.org/sage_trac/ticket/14066#comment:18 when ipython was upgraded to 0.13. Apparently it wouldn't be so easy to change. But it should work as I described in my comment; if it doesn't that's definitely a bug.

comment:5 Changed 9 years ago by Hugh Thomas

Milestone: sage-5.10sage-duplicate/invalid/wontfix
Status: newneeds_review

This behaviour is being changed at #14523, which also includes doctests. I think this ticket can be closed.

comment:6 Changed 9 years ago by Travis Scrimshaw

Reviewers: Travis Scrimshaw
Status: needs_reviewpositive_review

I concur.

comment:7 Changed 9 years ago by Jeroen Demeyer

Resolution: duplicate
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.