Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue25974

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:Fix statistics.py after the Decimal.as_integer_ratio() change
Type:behaviorStage:resolved
Components:Library (Lib)Versions:Python 3.6
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To: steven.dapranoNosy List: belopolsky, berker.peksag, johnwalker, mark.dickinson, ned.deily, python-dev, rhettinger, serhiy.storchaka, skrah, steven.daprano, terry.reedy
Priority:release blockerKeywords:3.5regression, patch

Created on2015-12-29 12:49 byskrah, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
statistics_as_integer_ratio.diffskrah,2015-12-29 12:49review
Messages (7)
msg257178 -(view)Author: Stefan Krah (skrah)*(Python committer)Date: 2015-12-29 12:49
Here's a fix for the fallout from#25928.  I've set it torelease blocker to make sure we don't forget.
msg257184 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2015-12-29 13:29
LGTM.I haven't tested that "type(x) is float or type(x) is Decimal" is faster than alternatives ("type(x) in (float, Decimal)", or "isinstance(x, (float, Decimal))", or "hasattr(x, 'as_integer_ratio')") and believe you have tested this.
msg257186 -(view)Author: Stefan Krah (skrah)*(Python committer)Date: 2015-12-29 13:46
No, I haven't done any benchmarks. In a quick test type(x) == floatdoes not seem any faster than isinstance(x, float), so perhaps wecould reduce the try/except complexity.
msg257190 -(view)Author: Stefan Krah (skrah)*(Python committer)Date: 2015-12-29 14:30
The clear winner for float and Decimal is hasattr(x, 'as_integer_ratio').The other types are a bit disadvantaged if the lookup fails, but theygo through additional try/excepts anyway.
msg257210 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2015-12-29 19:32
I believe the current code is well-weighed compromise that optimize different cases ranged for their frequency of occurrence (floats, ints, decimals, fractions, subclasses of int, float, etc and independed numeric types). And new addition unlikely will change the balance too much, but we have to be aware. If Steven have no something to add, the patch LGTM.
msg262826 -(view)Author: Stefan Krah (skrah)*(Python committer)Date: 2016-04-03 11:59
Ping. Just a reminder that it would be nice to get this into 3.6-alpha-1. :)
msg264968 -(view)Author: Berker Peksag (berker.peksag)*(Python committer)Date: 2016-05-06 12:02
statistics_as_integer_ratio.diff has been committed in7b2fafd78c1d.
History
DateUserActionArgs
2022-04-11 14:58:25adminsetnosy: +ned.deily
github: 70162
2016-05-06 12:02:09berker.peksagsetstatus: open -> closed

nosy: +berker.peksag
messages: +msg264968

resolution: fixed
stage: commit review -> resolved
2016-04-03 11:59:59skrahsetmessages: +msg262826
2015-12-29 19:32:46serhiy.storchakasetmessages: +msg257210
2015-12-29 14:30:03skrahsetmessages: +msg257190
2015-12-29 13:46:59skrahsetmessages: +msg257186
2015-12-29 13:29:04serhiy.storchakasetmessages: +msg257184
stage: commit review
2015-12-29 12:49:31skrahcreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp