#6179: [with patch, needs review] html -- doctest failure in sage-4.0.1.alpha0
---------------------+------------------------------------------------------
Reporter: was | Owner: mhansen
Type: defect | Status: assigned
Priority: blocker | Milestone: sage-4.0.1
Component: doctest | Keywords:
---------------------+------------------------------------------------------
Comment(by jhpalmieri):
Here's another possible fix for the latex_table issue:
{{{
try:
f = latex_table[type(x)]
return LatexExpr(f(x))
except KeyError:
if x is None:
return LatexExpr("\\mbox{\\mathrm{None}}")
return LatexExpr(str_function(str(x)))
}}}
Since {{{type(True)}}} returns {{{bool}}}, this looks up the right thing.
Is this approach better or worse than the one in your patch?
The try/except approach helps to avoid accidental lookups in the table,
but were those being used intentionally for anything? For example, does
{{{isinstance(blah, int)}}} return True for other classes that we care
about for typesetting? I tend to think that we should be more explicit
rather than implicit (so add more entries {{{new-type: str}}} if we want
more types to behave the way ints do), so I would favor the dictionary
lookup approach. I could be convinced otherwise, though.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6179#comment:4>
Sage <http://sagemath.org/>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---