Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #83392
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <jeanpierreda@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.037 |
| X-Spam-Evidence | '*H*': 0.93; '*S*': 0.00; 'exception,': 0.09; 'raises': 0.09; 'python': 0.11; 'bug': 0.12; 'informative.': 0.16; '>>>': 0.22; 'import': 0.22; 'error': 0.23; 'skip:" 30': 0.26; 'raise': 0.29; 'message-id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; "i'm": 0.30; '"",': 0.31; 'decimal': 0.31; 'subject:numbers': 0.31; 'subject:other': 0.31; 'file': 0.32; 'skip:c 30': 0.32; '(most': 0.33; 'noticed': 0.34; 'skip:d 20': 0.34; "i'd": 0.34; 'but': 0.35; 'received:google.com': 0.35; 'to:addr:python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'behavior': 0.77; '3.4': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=57S3ttvkRry8vtZWdE51m62Ic5W8WgfYjoKKwPeXqkw=; b=sQdvou05cLbw2YJKtI/whT6+BF19TXpC8tBu/Pl5F5kF/hmyyOtKkQgN22D1LG4Fnk 5A/b0nGwS9CZLvQExGBs1rR0U6DAQwv0GsH0qxlCzNkNdbtbWqpoGYnskXXDzMY6jg2y WT96101sxN1rNq/9RX7GNSVOUiPwqnAvsSme6n3XPUxv/Es+lLnSjKErrO3Jk9UEBxE/ R9OcJTR2qm+52Zy/R4bs2V8eBZpSTCa2fxegJzFpbX3ky2iDZwkDuamHfnNM7YOQcvgw oZNhJkK/qI+YhpsxjQEtMVTFa9NDMktjZDwyHj7yQoVqF3xw9p7Spj7Srag5J4gdcBBN wPMg== |
| X-Received | by 10.224.131.70 with SMTP id w6mr13351018qas.78.1420770841342; Thu, 08 Jan 2015 18:34:01 -0800 (PST) |
| MIME-Version | 1.0 |
| From | Devin Jeanpierre <jeanpierreda@gmail.com> |
| Date | Thu, 8 Jan 2015 18:33:21 -0800 |
| Subject | Decimals and other numbers |
| To | "comp.lang.python" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| 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.17496.1420770843.18130.python-list@python.org> (permalink) |
| Lines | 30 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1420770843 news.xs4all.nl 2900 [2001:888:2000:d::a6]:37599 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:83392 |
Show key headers only | View raw
I noticed some very PHP-ish behavior today:
>>> import decimal
>>> x = 0
>>> y = float(x)
>>> z = decimal.Decimal(x)
>>> x == y == z == x
True
>>> x ** x
1
>>> y**y
1.0
>>> z**z
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/decimal.py", line 2216, in __pow__
return context._raise_error(InvalidOperation, '0 ** 0')
File "/usr/lib/python2.7/decimal.py", line 3872, in _raise_error
raise error(explanation)
decimal.InvalidOperation: 0 ** 0
I'd file a bug report but I'm anticipating some rational (heh)
explanation. Any ideas?
Python 3.4 also raises this exception, but the error message is less
informative. ("decimal.InvalidOperation: [<class
'decimal.InvalidOperation'>]").
-- Devin
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Decimals and other numbers Devin Jeanpierre <jeanpierreda@gmail.com> - 2015-01-08 18:33 -0800
csiph-web