Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #21202
| Date | 2012-03-04 07:38 -0800 |
|---|---|
| From | Ethan Furman <ethan@stoneleaf.us> |
| Subject | Re: A possible change to decimal.Decimal? |
| References | <15610330.329.1330728373676.JavaMail.geo-discussion-forums@ynlw24> <mailman.358.1330734881.3037.python-list@python.org> <6422978.686.1330864625195.JavaMail.geo-discussion-forums@vbgu10> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.382.1330876879.3037.python-list@python.org> (permalink) |
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~
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
A possible change to decimal.Decimal? Jeff Beardsley <jbeard565@gmail.com> - 2012-03-02 14:46 -0800
Re: A possible change to decimal.Decimal? Ethan Furman <ethan@stoneleaf.us> - 2012-03-02 15:49 -0800
Re: A possible change to decimal.Decimal? "A. Lloyd Flanagan" <A.Lloyd.Flanagan@gmail.com> - 2012-03-04 04:37 -0800
Re: A possible change to decimal.Decimal? "A. Lloyd Flanagan" <A.Lloyd.Flanagan@gmail.com> - 2012-03-04 04:37 -0800
Re: A possible change to decimal.Decimal? Ethan Furman <ethan@stoneleaf.us> - 2012-03-04 07:38 -0800
Re: A possible change to decimal.Decimal? Ethan Furman <ethan@stoneleaf.us> - 2012-03-04 07:44 -0800
csiph-web