Re: [sympy] Is piece of code in StrPrinter ever reachable?

2021-02-13 Thread Oscar Benjamin
On Sat, 13 Feb 2021 at 12:34, Paul Royik  wrote:
>
> 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?

Non-Basic objects can also be printed using the printers. They just
need to inherit Printable (which is a superclass of Basic).


Oscar

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAHVvXxSi03TNcr8VZuZ%3DM20oqYLuU3sNTr7pYHxpYdViOxfKhA%40mail.gmail.com.


[sympy] Is piece of code in StrPrinter ever reachable?

2021-02-13 Thread Paul Royik
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? 

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/718ba707-4e22-4a0c-9068-fc9346874b96n%40googlegroups.com.