Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83277

Re: Comparisons and sorting of a numeric class....

From Terry Reedy <tjreedy@udel.edu>
Subject Re: Comparisons and sorting of a numeric class....
Date 2015-01-06 21:34 -0500
References <54ABB88A.7070504@r3dsolutions.com> <54ABC52A.1050507@davea.name> <54ABE383.3020801@r3dsolutions.com> <54ABEAD9.8070000@davea.name> <54AC938C.7040206@r3dsolutions.com>
Newsgroups comp.lang.python
Message-ID <mailman.17427.1420598144.18130.python-list@python.org> (permalink)

Show all headers | View raw


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

[snip]

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)
5.6


-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Comparisons and sorting of a numeric class.... Terry Reedy <tjreedy@udel.edu> - 2015-01-06 21:34 -0500

csiph-web