[Python-ideas] Compact repr operator (i.e., __short_repr__)

Random832 random832 at fastmail.com
Thu Feb 11 11:28:58 EST 2016


On Thu, Feb 11, 2016, at 05:59, Steven D'Aprano wrote:
> Some time ago, I started working on a library for continued fractions. I 
> count at least five useful/standard representations for a continued 
> fraction. All of these would be equivalent:

> (Apart from the first, the remaining four are standard notations used 
> in mathematics.)

How about 1+\dfrac 1{2+\dfrac 1{3+\dfrac 1{4+\dfrac 1 5}}}?

A way to get a "mathematical abstract syntax tree" that can be operated
on and transformed into that or any of your notations
[1+1/(2+1/(3+1/(4+1/5))) might be the default] for numeric objects (and
other things such as matrices and vectors) might be nice.


More information about the Python-ideas mailing list