Comparisons and sorting of a numeric class....

Terry Reedy tjreedy at
Wed Jan 7 03:34:57 CET 2015

On 1/6/2015 9:01 PM, Andrew Robinson wrote:


There are very few (about 4) builtin classes that cannot be subclassed. 
  bool is one of those few, float is not.  Go ahead and subclass it.

 >>> class F(float): pass

 >>> F
<class '__main__.F'>
 >>> F(2.3) + F(3.3)

Terry Jan Reedy

More information about the Python-list mailing list