[docs] https://docs.python.org/3/library/decimal.html documentation issue

Julien Palard julien at palard.fr
Tue May 21 08:46:45 EDT 2019


Hi Sam! Thanks for reporting!

> on the doc page there is:
>
> >>> Decimal('7.325').quantize(Decimal('.01'), rounding=ROUND_DOWN)
>
> but "name 'ROUND_DOWN' is not defined"
>
> This worked though :)
>
> >>> Decimal('7.325').quantize(Decimal('.01'), rounding='ROUND_DOWN')

If you search ROUND_DOWN in the page you'll find it's a constant of the decimal module, so you're missing a:

from decimal import ROUND_DOWN

Your solution works because ROUND_DOWN is defined as "ROUND_DOWN", but you should use the constant instead :)
-- 
Julien Palard
https://mdk.fr




More information about the docs mailing list