[issue12580] Documentation error in Decimal module

2011-07-17 Thread Steve Holden

New submission from Steve Holden st...@holdenweb.com:

We see in the Quick-Start Tutorial (py3k section 8.4.1) the following example:

 Decimal(3.14)
Decimal('3.140124344978758017532527446746826171875')

In actua; fact one would expect an exception from that code, which should 
perhaps instead read

 Decimal.from_float(3.14)
Decimal('3.140124344978758017532527446746826171875')

This class method is the recommended way to convert floats to decimal when 
necessary.

--
assignee: georg.brandl
messages: 140531
nosy: georg.brandl, holdenweb
priority: normal
severity: normal
status: open
title: Documentation error in Decimal module
versions: Python 3.1, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12580
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12580] Documentation error in Decimal module

2011-07-17 Thread Steve Holden

Changes by Steve Holden st...@holdenweb.com:


--
components: +Documentation

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12580
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12580] Documentation error in Decimal module

2011-07-17 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

Behavior for mixed operations varies greatly between Python versions.

The first table over here lists the differences and should be valid
for decimal.py:

http://www.bytereef.org/mpdecimal/doc/cdecimal/index.html#floatoperation-signal


As an extension, cdecimal has the FloatOperation signal, which
enforces stricter semantics. The second table on that page lists
the behavior if the signal is enabled.

--
nosy: +skrah

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12580
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12580] Documentation error in Decimal module

2011-07-17 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee: georg.brandl - rhettinger
nosy: +rhettinger
versions: +Python 3.3 -Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12580
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12580] Documentation error in Decimal module

2011-07-17 Thread Raymond Hettinger

Raymond Hettinger raymond.hettin...@gmail.com added the comment:

The example is correct and runs as expected:

 Decimal(3.14)
Decimal('3.140124344978758017532527446746826171875')

Per the Whatsnew3.2 document:
'''
The decimal.Decimal constructor now accepts float objects directly so there in 
no longer a need to use the from_float() method (issue 8257).
'''

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12580
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12580] Documentation error in Decimal module

2011-07-17 Thread Steve Holden

Steve Holden st...@holdenweb.com added the comment:

Sorry about that. I was using 3.1, as you will have gathered.

--
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12580
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com