On Tue, Apr 1, 2008 at 11:28 PM, David Roe <[EMAIL PROTECTED]> wrote: > > That's the plan. Though I'll have to ask around to figure out how to > determine if _repr_ is being called from the notebook or iPython.
In most cases the base class __repr__ just calls _repr_, and the notebook and/or Ipython no nothing about this -- they always call __repr__ (or __str__). def __repr__(self): if hasattr(self, '__custom_name'): name = self.__custom_name if name is not None: return name if hasattr(self, '_repr_'): return self._repr_() return str(type(self)) > David > > > > On Tue, Apr 1, 2008 at 7:01 PM, Dan Drake <[EMAIL PROTECTED]> wrote: > > Robert Bradshaw wrote: > > > Thanks for your input. We are considering a more advanced model > > > (David Roe has lots of ideas on this front), but this falls outside > > > of the central focus coercion scheme. (This is one reason to use > > > _repr_ rather than the Python __repr__ so that the base object's > > > __repr__ can do more sophisticated things (although now it just calls > > > _repr_). > > > > I would really like something like this. For example, take Young > > tableaux: when working in the Sage interpreter, I might want a tableau > > to print out like this: > > > > 7532 > > 642 > > 632 > > 1 > > > > but in the notebook interface, or for including into a LaTeX document, I > > might want the tableau to print out a TikZ picture environment: > > > > \begin{tikzpicture} > > \draw ... > > \end{tikzpicture} > > > > Also, Francophones will want those same things printed upside down. :) > > So more flexibility, and multiple printed representations, would be very > > nice. > > > > Dan > > > > -- > > --- Dan Drake <[EMAIL PROTECTED]> > > ----- KAIST Department of Mathematical Sciences > > ------- http://math.kaist.ac.kr/~drake > > > > -----BEGIN PGP SIGNATURE----- > > Version: GnuPG v1.4.6 (GNU/Linux) > > > > iD8DBQFH8ujrr4V8SljC5LoRAv81AJ0YtScjIEi9FCAQ9uk12ZcIJcCTJwCeK1Nc > > fs73ezUTiHz0Dj+6Cf2F2f0= > > =hS/w > > -----END PGP SIGNATURE----- > > > > > > > > > > -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---