[issue25971] Optimize converting float and Decimal to Fraction

2015-12-29 Thread Mark Dickinson

Mark Dickinson added the comment:

Any particular reason for the lower-casing of "Cannot" to "cannot" in the 
exception messages?

Otherwise, LGTM.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25971] Optimize converting float and Decimal to Fraction

2015-12-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you all for your review.

--
assignee:  -> serhiy.storchaka
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25971] Optimize converting float and Decimal to Fraction

2015-12-28 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch makes following things:

1. Rewrite error messages in float.as_integer_ratio() and Python implementation 
of Decimal.as_integer_ratio() in more general form, not mentioning 
as_integer_ratio(), as in C implementation of Decimal.as_integer_ratio().

2. Use Decimal.as_integer_ratio() to convert Decimal to Fraction.

3. Get rid of additional checks in Fraction constructor that raise errors with 
appropriate messages, since new error messages from as_integer_ratio() are 
appropriate enough.

This speeds up creating a Fraction from float and Decimal 2 to 3 times.

--
components: Interpreter Core, Library (Lib)
files: fraction_from_floating.patch
keywords: patch
messages: 257145
nosy: facundobatista, mark.dickinson, rhettinger, serhiy.storchaka, skrah
priority: normal
severity: normal
stage: patch review
status: open
title: Optimize converting float and Decimal to Fraction
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file41442/fraction_from_floating.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com