On 8/6/13 8:40 AM, John Cremona wrote:
Thanks for the explanations. Are there other classes where there are
many different output representations, controlled by parameters to the
str() function istead of by setting defaults for the class?
RealNumber is another one that I patched a long time ago, but it still
"in progress":
http://trac.sagemath.org/ticket/7682
But I agree with the comments at the end of the ticket that printing
defaults should be module variables (possibly collected into an
interface) and not stored as defaults in an instantiated class, pickled
with the class, etc: http://trac.sagemath.org/ticket/7682#comment:33
Here are a few more str and repr functions that might be like what you
are asking for:
% ack -u "def _*str_*\(self,"
combinat/iet/template.py
309: def str(self, sep= "\n"):
1894: def str(self, sep="\n"):
interfaces/gap.py
1542: def str(self, use_file=False):
matrix/matrix0.pyx
1742: def str(self, rep_mapping=None, zero=None, plus_one=None,
minus_one=None):
matrix/matrix_mod2_dense.pyx
441: def str(self, rep_mapping=None, zero=None, plus_one=None,
minus_one=None):
rings/complex_interval.pyx
211: def str(self, base=10, style=None):
rings/complex_mpc.pyx
1047: def str(self, int base=10, int truncate=True):
rings/complex_number.pyx
461: def str(self, base=10, truncate=True, istr='I'):
rings/integer.pyx
1060: def str(self, int base=10):
rings/padics/padic_generic_element.pyx
465: def str(self, mode=None):
rings/rational.pyx
1944: def str(self, int base=10):
rings/real_mpfi.pyx
1446: def str(self, int base=10, style=None, no_sci=None, e=None,
error_digits=None):
rings/real_mpfr.pyx
1727: def str(self, int base=10, no_sci=None, e=None, int truncate=1,
bint skip_zeroes=0):
% ack -u "def _*repr_*\(self,"
combinat/crystals/kirillov_reshetikhin.py
2968: def __repr__(self, pretty_printing = None):
combinat/partition.py
697: def _repr_(self, compact=False):
combinat/partition_tuple.py
476: def _repr_(self, compact=False):
combinat/root_system/cartan_type.py
2045: def _repr_(self, compact = False):
2224: def _repr_(self, compact = False):
combinat/root_system/type_dual.py
164: def _repr_(self, compact = False):
548: def _repr_(self, compact=False):
combinat/root_system/type_reducible.py
133: def _repr_(self, compact = True): # We should make a consistent
choice here
combinat/root_system/type_relabel.py
194: def _repr_(self, compact = False):
finance/time_series.pyx
285: def _repr(self, prec=None):
rings/padics/eisenstein_extension_generic.py
39: def _repr_(self, do_latex = False):
rings/padics/padic_base_leaves.py
254: def _repr_(self, do_latex=False):
290: def _repr_(self, do_latex = False):
396: def _repr_(self, do_latex=False):
496: def _repr_(self, do_latex=False):
rings/padics/padic_generic_element.pyx
476: def _repr_(self, mode=None, do_latex=False):
rings/padics/unramified_extension_generic.py
53: def _repr_(self, do_latex = False):
rings/polynomial/padics/polynomial_padic_capped_relative_dense.py
306: def _repr(self, name=None):
rings/polynomial/padics/polynomial_padic_flat.py
62: def _repr(self, name=None):
rings/polynomial/polynomial_element.pyx
1468: def _repr(self, name=None):
rings/polynomial/polynomial_element_generic.py
240: def _repr(self, name=None):
702: def _repr(self, name=None):
rings/polynomial/polynomial_integer_dense_flint.pyx
422: def _repr(self, name=None, bint latex=False):
rings/polynomial/polynomial_integer_dense_ntl.pyx
330: def _repr(self, name=None, bint latex=False):
tensor/differential_form_element.py
138: def repr(self, comp, fun):
Thanks,
Jason
--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.