Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #83278
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!81.171.88.16.MISMATCH!hq-usenetpeers.eweka.nl!hq-usenetpeers.eweka.nl!bcyclone01.am1.xlned.com!bcyclone01.am1.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <andrew3@r3dsolutions.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.012 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'output': 0.05; 'float': 0.07; 'builtin': 0.09; 'received:172.16.0': 0.09; 'python': 0.11; 'accepting': 0.14; '(about': 0.16; 'bool': 0.16; 'guessing': 0.16; 'reedy': 0.16; 'subclass': 0.16; 'subtype': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'stack': 0.19; '>>>': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'issue,': 0.24; 'script': 0.25; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'received:172.16': 0.29; 'andrew': 0.30; 'getting': 0.31; 'class': 0.32; 'worked': 0.33; 'not.': 0.33; 'classes': 0.35; 'but': 0.35; 'there': 0.35; 'doing': 0.36; 'thanks': 0.36; 'two': 0.37; 'ahead': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'took': 0.61; 'received:phx3.secureserver.net': 0.65; 'received:prod.phx3.secureserver.net': 0.65; 'trial': 0.83; '5.6': 0.84; 'received:68.178.252': 0.84; 'relief.': 0.84; 'received:68.178': 0.91 |
| Date | Tue, 06 Jan 2015 18:53:23 -0800 |
| From | Andrew Robinson <andrew3@r3dsolutions.com> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Comparisons and sorting of a numeric class.... |
| References | <54ABB88A.7070504@r3dsolutions.com> <54ABC52A.1050507@davea.name> <54ABE383.3020801@r3dsolutions.com> <54ABEAD9.8070000@davea.name> <54AC938C.7040206@r3dsolutions.com> <m8i60t$fp3$1@ger.gmane.org> |
| In-Reply-To | <m8i60t$fp3$1@ger.gmane.org> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.17428.1420599294.18130.python-list@python.org> (permalink) |
| Lines | 26 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1420599294 news.xs4all.nl 2921 [2001:888:2000:d::a6]:41202 |
| X-Complaints-To | abuse@xs4all.nl |
| X-Received-Body-CRC | 76875412 |
| X-Received-Bytes | 3720 |
| Xref | csiph.com comp.lang.python:83278 |
Show key headers only | View raw
On 01/06/2015 06:34 PM, Terry Reedy wrote: > 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 > > Thanks terry! That's a relief. Ive just managed to find a few classes that won't subtype by trial and error in the last two months and was getting pessimistic. ( eg: doing web pages I wanted to customize the error output traceback stack from a python script based on where the exception occurred..... UUUUGH! I worked around the no sub-typing issue, but it took a lot of guessing to trick python into accepting a fake class to the print traceback functions the webserver used... )
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Comparisons and sorting of a numeric class.... Andrew Robinson <andrew3@r3dsolutions.com> - 2015-01-06 18:53 -0800
csiph-web