[sage-devel] Re: Change of semantics for 'show'

2015-05-03 Thread Volker Braun
On Thursday, April 30, 2015 at 8:19:39 AM UTC+2, Martin R wrote: > > I'm only trying to understand. Yes, I assume it happens that someone is > using sage as a python library and then possibly only wants repr. > If you use Sage as a Python library then you are in control of the displayhook. The

[sage-devel] Re: Change of semantics for 'show'

2015-04-29 Thread 'Martin R' via sage-devel
Am Donnerstag, 30. April 2015 05:56:11 UTC+2 schrieb Volker Braun: > > On Wednesday, April 29, 2015 at 11:37:38 PM UTC-4, Martin R wrote: >> >> Oh, now that's an explanation! So the explanation in the third post on >> this thread, >> displayhook: calls __repr__ on the value of the last stat

[sage-devel] Re: Change of semantics for 'show'

2015-04-29 Thread Volker Braun
On Wednesday, April 29, 2015 at 11:37:38 PM UTC-4, Martin R wrote: > > Oh, now that's an explanation! So the explanation in the third post on > this thread, > displayhook: calls __repr__ on the value of the last statement and > sends to stdout > was a bit misleading. > Well that was about

[sage-devel] Re: Change of semantics for 'show'

2015-04-29 Thread 'Martin R' via sage-devel
Oh, now that's an explanation! So the explanation in the third post on this thread, displayhook: calls __repr__ on the value of the last statement and sends to stdout was a bit misleading. Thanks for clarifying. (In turn, this begs the question, when is repr used for display instead of

[sage-devel] Re: Change of semantics for 'show'

2015-04-29 Thread Volker Braun
I probably don't understand your question, so let me try a different answer in the hopes that that is what you were asking: The _rich_repr_() method is always called by the displayhook. If the object doesn't have one (AttributeError), or if it does not return anything (i.e. returns None) then w

[sage-devel] Re: Change of semantics for 'show'

2015-04-29 Thread 'Martin R' via sage-devel
I don't understand this answer. Am I the only one who doesn't get it? If so, don't bother to explain, I'm giving up. (I looked for _rich_repr on trac which gives me 9 tickets, none of which looked like it would explain to me when rich_repr is called, and I searched the online doc for rich_rep

[sage-devel] Re: Change of semantics for 'show'

2015-04-29 Thread Volker Braun
On Wednesday, April 29, 2015 at 9:52:19 AM UTC-4, Martin R wrote: > > But why do we get _rich_repr_ on the console in the first place??? > * display ascii art as rich representation on the console * launch viewer when a Graphics object hits the displayhook -- You received this message because

[sage-devel] Re: Change of semantics for 'show'

2015-04-29 Thread 'Martin R' via sage-devel
But why do we get _rich_repr_ on the console in the first place??? Martin Am Mittwoch, 29. April 2015 15:48:13 UTC+2 schrieb Volker Braun: > > On Wednesday, April 29, 2015 at 7:16:20 AM UTC-4, Martin R wrote: >> >> I have read this thread, but I fail to understand the reason. Eg., there >> is a

[sage-devel] Re: Change of semantics for 'show'

2015-04-29 Thread Volker Braun
On Wednesday, April 29, 2015 at 7:16:20 AM UTC-4, Martin R wrote: > > I have read this thread, but I fail to understand the reason. Eg., there > is a commit "extrawurst for graphs". I thought that by default all objects > would display in the console their repr. The commit seems to indicate th

[sage-devel] Re: Change of semantics for 'show'

2015-04-29 Thread 'Martin R' via sage-devel
I have read this thread, but I fail to understand the reason. Eg., there is a commit "extrawurst for graphs". I thought that by default all objects would display in the console their repr. The commit seems to indicate that this doesn't work for graphs. Why? Martin Am Mittwoch, 29. April 20

[sage-devel] Re: Change of semantics for 'show'

2015-04-29 Thread Volker Braun
This is http://trac.sagemath.org/ticket/18289 On Wednesday, April 29, 2015 at 2:31:15 AM UTC-4, Martin R wrote: > > But then, why doesn't > > sage: graphs.PetersenGraph() > > output its repr and launches a viewer instead? Is this because, as yo

[sage-devel] Re: Change of semantics for 'show'

2015-04-28 Thread 'Martin R' via sage-devel
Am Mittwoch, 29. April 2015 02:12:50 UTC+2 schrieb Volker Braun: > > On Tuesday, April 28, 2015 at 12:35:57 PM UTC-4, Martin R wrote: >> >> So, plot(x) would have no side effect, instead I would have to call >> show() on the result? Slightly weird, but still OK for me. >> > > Not sure I underst

[sage-devel] Re: Change of semantics for 'show'

2015-04-28 Thread Volker Braun
On Tuesday, April 28, 2015 at 12:35:57 PM UTC-4, Martin R wrote: > > So, plot(x) would have no side effect, instead I would have to call show() > on the result? Slightly weird, but still OK for me. > Not sure I understand, so just to clarify: The current behavior is that plot() has no side effe

[sage-devel] Re: Change of semantics for 'show'

2015-04-28 Thread 'Martin R' via sage-devel
Am Dienstag, 28. April 2015 16:47:24 UTC+2 schrieb Volker Braun: > > Thats not really the topic but why not... > I'm sorry about having asked an off topic question. I did not realise that I did. > * view() should be renamed to something that is suggestive of what it > actually does, maybe p

Re: [sage-devel] Re: Change of semantics for 'show'

2015-04-28 Thread Nathann Cohen
> * view() should be renamed to something that is suggestive of what it > actually does, maybe pdflatex(). +1 > * Add a warning (or deprecation) in show() to use pretty_print() instead as > it is more indicative of what it actually does. This is #18302 +1 > * Similar to latex(), there is a html()

[sage-devel] Re: Change of semantics for 'show'

2015-04-28 Thread Volker Braun
On Tuesday, April 28, 2015 at 4:19:25 AM UTC-4, Martin R wrote: > > Could you please comment, what you'd like to change? > Thats not really the topic but why not... * view() should be renamed to something that is suggestive of what it actually does, maybe pdflatex(). In http://trac.sagemath.o

[sage-devel] Re: Change of semantics for 'show'

2015-04-28 Thread 'Martin R' via sage-devel
I set up some examples, together with output in emacs (sage mode), except for plot. Could you please comment, what you'd like to change? Except for plot, the results seem relatively consistent to me, but of course, this may be because I'm using the console. Thanks for your patience, Martin

[sage-devel] Re: Change of semantics for 'show'

2015-04-27 Thread Volker Braun
On Monday, April 27, 2015 at 3:13:31 PM UTC-4, Martin R wrote: > > * __repr__ (or SageObject._repr_): return a string >> * print: Immediately sends the output of __repr__ to stdout >> > I think it sends __str__ to stdout. > If you define __str__ in addition to __repr__ (allowable but probably som

[sage-devel] Re: Change of semantics for 'show'

2015-04-27 Thread 'Martin R' via sage-devel
Am Montag, 27. April 2015 19:18:35 UTC+2 schrieb Volker Braun: > > __repr__ >> print >> > > We should be able to agree on these as they are part of the plain Python > language. > > * __repr__ (or SageObject._repr_): return a string > > * print: Immediately sends the output of __repr__ to stdout

[sage-devel] Re: Change of semantics for 'show'

2015-04-27 Thread Volker Braun
On Monday, April 27, 2015 at 4:45:42 AM UTC-4, Martin R wrote: > > Is there any concise description (possibly proposed) of what the different > output functions should do? I know of the following functions, and have my > personal expectations, but I'd be interested in others: > __repr__ > print

[sage-devel] Re: Change of semantics for 'show'

2015-04-27 Thread 'Martin R' via sage-devel
Am Montag, 27. April 2015 09:07:50 UTC+2 schrieb Nathann Cohen: > > Thus 'show', whose meaning is quite different from pretty_print, will > [...] Is there any concise description (possibly proposed) of what the different output functions should do? I know of the following functions, and have