Is piece of code in StrPrinter ever reachable?

14 views
Skip to first unread message

Paul Royik

unread,
Feb 13, 2021, 7:34:38 AM2/13/21
to sympy
In StrPrinter there is 
def emptyPrinter(self, expr):
if isinstance(expr, str):
return expr
elif isinstance(expr, Basic):
return repr(expr)
else:
return str(expr)

Is `return repr(expr)` reachable if `StrPrinter` defines `_print_Basic` that prints all `Basic` objects? 

Oscar Benjamin

unread,
Feb 13, 2021, 7:50:34 AM2/13/21
to sympy
Non-Basic objects can also be printed using the printers. They just
need to inherit Printable (which is a superclass of Basic).


Oscar
Reply all
Reply to author
Forward
0 new messages