Opened 9 years ago

Last modified 3 months ago

#9048 new defect

inconsistencies between the terminal version and the notebook

Reported by: zimmerma Owned by: jason, was
Priority: major Milestone: sage-wishlist
Component: notebook Keywords:
Cc: eocansey@… Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by zimmerma)

In the text version of Sage, var('x'); does not print anything. However, in the notebook, it prints x, even with the ; that should prevent output. This is quite annoying. Is there a reason for that?

Also, automatic_names does not work in the terminal version.

Change History (10)

comment:1 Changed 9 years ago by jason

  • Summary changed from different behaviour of var in notebook and text version to semicolon does not suppress output in the notebook

Changed the title to identify the underlying issue. Note that 1+2; also prints out something in the notebook, but not in the command line.

My guess is that it is a convention in ipython, since a semicolon does nothing in just plain python:

% sage -python
Python 2.6.4 (r264:75706, May  6 2010, 23:38:46) 
[GCC 4.2.1 (Apple Inc. build 5659)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 1+2;
3


comment:2 Changed 6 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:3 follow-up: Changed 6 years ago by zimmerma

  • Summary changed from semicolon does not suppress output in the notebook to inconsistencies between the terminal version and the notebook

note sure what to do with this ticket. At least we can try to list all inconsistencies between the terminal version and the notebook:

  • 1+2; does not print anything in the terminal version, but does print something in the notebook
  • __ and ____ do not work in the notebook
  • automatic_names does not work in the terminal version

Are there any other differences?

Paul

comment:4 in reply to: ↑ 3 Changed 6 years ago by nbruin

Replying to zimmerma:

  • 1+2; does not print anything in the terminal version, but does print something in the notebook

The printing in the notebook is a little more different than just that:

1;2;

prints

1
2

whereas

1
2

prints

2

and

(1
)

prints nothing, whereas

(1)

prints

1

i.e., it seems that all results from statements contained entirely on the last line of the cell are printed, regardless of semicolons, and no other results are. To me this seems a little arbitrary, but resolving this is probably something for the notebook.

comment:5 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:6 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:7 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:8 Changed 3 years ago by zimmerma

  • Description modified (diff)

I've added automatic_names in the description as a reminder, since we write in our book about Sage (which is currently being translated to english) that automatic_names does not work in the terminal version.

comment:9 Changed 3 months ago by embray

  • Milestone changed from sage-6.4 to sage-wishlist

automatic_names also doesn't work in the Jupyter Notebook. This was also discussed in #25837. I looked into this a bit à year ago, and it turns out the automatic_names implementation lives in sagenb. It needs to be moved into the main sage package, and will take some adjusting to integrate into the IPython terminal and Jupyter kernel interfaces.

comment:10 Changed 3 months ago by embray

  • Cc eocansey@… added

I thought I also made a ticket specifically for this issue but I can't find it now, so maybe this is just the one.

Note: See TracTickets for help on using tickets.