Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'received:184.172': 0.09; 'received:gator410.hostgator.com': 0.09; '~ethan~': 0.09; 'def': 0.13; 'jeff': 0.13; 'history:': 0.16; 'other)': 0.16; 'received:50': 0.16; 'subject:possible': 0.16; 'cc:addr:python- list': 0.16; 'subject:skip:d 10': 0.17; 'wrote:': 0.18; '>>>': 0.18; 'arguments': 0.18; 'cc:no real name:2**0': 0.21; 'header:In- Reply-To:1': 0.22; 'subject:change': 0.24; 'import': 0.27; 'cc:addr:gmail.com': 0.28; 'class': 0.29; 'cc:addr:python.org': 0.29; 'generally': 0.30; 'for,': 0.30; 'use?': 0.30; 'subject:?': 0.31; 'header:User-Agent:1': 0.33; 'agree': 0.33; 'done.': 0.34; '...': 0.35; 'cc:2**1': 0.36; 'friday,': 0.37; 'charset:us-ascii': 0.37; 'skip:_ 10': 0.38; 'doing': 0.38; 'should': 0.38; 'being': 0.40; 'march': 0.61; 'received:websitewelcome.com': 0.64; 'received:69.93': 0.67; 'hand,': 0.76; 'other):': 0.84 Date: Sun, 04 Mar 2012 07:38:58 -0800 From: Ethan Furman User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: "A. Lloyd Flanagan" Subject: Re: A possible change to decimal.Decimal? References: <15610330.329.1330728373676.JavaMail.geo-discussion-forums@ynlw24> <6422978.686.1330864625195.JavaMail.geo-discussion-forums@vbgu10> In-Reply-To: <6422978.686.1330864625195.JavaMail.geo-discussion-forums@vbgu10> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator410.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-BWhitelist: no X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: c-50-137-149-57.hsd1.or.comcast.net ([192.168.74.2]) [50.137.149.57]:3923 X-Source-Auth: ethan+stoneleaf.us X-Email-Count: 4 X-Source-Cap: dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ== Cc: python-list@python.org, Jeff Beardsley X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1330876879 news.xs4all.nl 6954 [2001:888:2000:d::a6]:56536 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:21202 A. Lloyd Flanagan wrote: > On Friday, March 2, 2012 6:49:39 PM UTC-5, Ethan Furman wrote: >> Jeff Beardsley wrote: >>> HISTORY: > ... >> What you should be doing is: >> >> import decimal >> from decimal import Decimal >> >> reload(decimal) >> Decimal = decimal.Decimal # (rebind 'Decimal' to the reloaded code) >> >> ~Ethan~ > > Agree that's how the import should be done. On the other hand, removing gratuitous use of isinstance() is generally a Good Thing. Gratuitous use? How is it gratuitous for an class to check that one of its arguments is its own type? class Frizzy(object): def __add__(self, other): if not isinstance(other, Frizzy): return NotImplemented do_stuff_with(self, other) This is exactly what isinstance() is for, and this is how it is being used in Decimal.__init__(). ~Ethan~