Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #21154
| Path | csiph.com!usenet.pasdenom.info!aioe.org!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 | <ethan@stoneleaf.us> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'own.': 0.03; 'python': 0.08; '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; 'error:': 0.10; 'read.': 0.10; 'jeff': 0.13; '#this': 0.16; '(django,': 0.16; '2.7.2': 0.16; 'earlier)': 0.16; 'history:': 0.16; 'patching': 0.16; 'received:72.11': 0.16; 'received:72.11.125': 0.16; 'received:72.11.125.166': 0.16; 'subject:possible': 0.16; 'unexpectedly': 0.16; 'cc:addr:python- list': 0.16; 'subject:skip:d 10': 0.17; 'wrote:': 0.18; '(which': 0.19; 'cc:no real name:2**0': 0.21; 'header:In-Reply-To:1': 0.22; 'happen.': 0.23; 'fine': 0.24; 'subject:change': 0.24; 'convert': 0.25; 'cc:2**0': 0.26; 'code': 0.26; 'import': 0.27; 'problem': 0.29; 'cc:addr:python.org': 0.29; '(and': 0.30; 'value)': 0.30; 'subject:?': 0.31; 'break': 0.32; 'header:User-Agent:1': 0.33; 'test': 0.34; 'probably': 0.35; 'project': 0.35; 'but': 0.37; 'using': 0.37; 'posts': 0.38; 'some': 0.38; 'doing': 0.38; 'should': 0.38; 'called': 0.40; 'received:websitewelcome.com': 0.64; 'received:69.93': 0.67; 'discovered': 0.70; 'revealed': 0.71; 'received:gateway15.websitewelcome.com': 0.84 |
| Date | Fri, 02 Mar 2012 15:49:39 -0800 |
| From | Ethan Furman <ethan@stoneleaf.us> |
| User-Agent | Thunderbird 1.5.0.10 (Windows/20070221) |
| MIME-Version | 1.0 |
| To | Jeff Beardsley <jbeard565@gmail.com> |
| Subject | Re: A possible change to decimal.Decimal? |
| References | <15610330.329.1330728373676.JavaMail.geo-discussion-forums@ynlw24> |
| In-Reply-To | <15610330.329.1330728373676.JavaMail.geo-discussion-forums@ynlw24> |
| Content-Type | text/plain; charset=ISO-8859-1; 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 | mail.admailinc.com ([192.168.10.136]) [72.11.125.166]:2409 |
| X-Source-Auth | ethan+stoneleaf.us |
| X-Email-Count | 7 |
| X-Source-Cap | dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ== |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.358.1330734881.3037.python-list@python.org> (permalink) |
| Lines | 35 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1330734881 news.xs4all.nl 6952 [2001:888:2000:d::a6]:45844 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:21154 |
Show key headers only | View raw
Jeff Beardsley wrote:
> HISTORY:
>
> In using python 2.7.2 for awhile on a web project (apache/wsgi web.py), I discovered a problem in using decimal.Decimal. A short search revealed that many other people have been having the problem as well, in their own apache/wsgi implementations (django, mostly), but I found no real solutions among the posts I read. So I did some experimentation of my own.
>
> The following code will break unexpectedly on standard python2.7 (and earlier) because of the way that isinstance fails after reload() (which is called by both of the above web frameworks).
>
> This is the error: TypeError("Cannot convert %r to Decimal" % value)
>
> THE TEST CODE
>
> import decimal
> from decimal import Decimal
>
> #this works
> Decimal(Decimal())
>
> reload(decimal)
>
> #this fails before patching, but works fine afterwards
> Decimal(Decimal())
>
Patching decimal.py to make it work with reload() is probably not going
to happen.
What you should be doing is:
import decimal
from decimal import Decimal
reload(decimal)
Decimal = decimal.Decimal # (rebind 'Decimal' to the reloaded code)
~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