[issue29677] 'round()' accepts a negative integer for ndigits

2017-03-01 Thread Vedran Čačić
Vedran Čačić added the comment: This is one of those things that show Python being extremely consistent within itself. Of course, docs should be clarified if needed, but the feature is desirable and useful. -- nosy: +veky ___ Python tracker

[issue29677] 'round()' accepts a negative integer for ndigits

2017-02-28 Thread Gerrit Holl
Changes by Gerrit Holl : -- pull_requests: +304 ___ Python tracker ___ ___

[issue29677] 'round()' accepts a negative integer for ndigits

2017-02-28 Thread Mark Dickinson
Mark Dickinson added the comment: Yes, I think the initial description could be clarified. It currently reads: > Return the floating point value number rounded to ndigits digits after the > decimal point. ... which doesn't make it clear what happens for negative ndigits. There's a line in

[issue29677] 'round()' accepts a negative integer for ndigits

2017-02-28 Thread ChrisRands
ChrisRands added the comment: Ah yes, you're both completely right of course. Perhaps the docs could still be clarified though. I managed to completely overlook this, and perhaps other non-expert Python users would too. -- ___ Python tracker

[issue29677] 'round()' accepts a negative integer for ndigits

2017-02-28 Thread Mark Dickinson
Mark Dickinson added the comment: Yep, it's (genuinely) a feature, not a bug, and being able to round to the nearest ten, hundred, thousand, etc. is useful. The docs could perhaps be improved to make it clearer that this is supported. -- assignee: -> docs@python components:

[issue29677] 'round()' accepts a negative integer for ndigits

2017-02-28 Thread Gerrit Holl
Gerrit Holl added the comment: >>> round(21345, -2) 21300 Desired and useful to me. -- nosy: +Gerrit.Holl ___ Python tracker ___

[issue29677] 'round()' accepts a negative integer for ndigits

2017-02-28 Thread ChrisRands
New submission from ChrisRands: With a negative integer for ndigits the output from 'round()', for example 'round(3, -2)', is always zero ('0' for 'int.__round__' and '0.0' or '-0.0' for 'float.__round__'). I think either it should raise an exception or the docs should be updated to reflect