A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-October/029409.html below:

PEP239 (Rational Numbers) Reference Implementation and new issues

[Python-Dev] Re: PEP239 (Rational Numbers) Reference Implementation and new issues [Python-Dev] Re: PEP239 (Rational Numbers) Reference Implementation and new issuesOren Tirosh oren-py-d@hishome.net
Wed, 9 Oct 2002 02:02:12 +0200
On Tue, Oct 08, 2002 at 12:09:57PM -0400, Guido van Rossum wrote:
>
> > '3/5'
> 
> I'd like at least one of those return '0.6' or '0.6r'.  

Why should any of them go through a potetially lossy transformation?
If you need to approximate a ratio as a finite decimal fraction it should 
be explicit: str(float(r)). 

I think it will also make a good visual cue to always use rational notation 
for rationals and decimal fractions for floats.

The result of repr() should eval() back to exactly the same object. The 
result of str() should be the 'pretty' representation because this is the 
form displayed by print statements and %s formatting. I find '2/3' prettier 
than '0.666666666667'

pretty-is-in-the-eyes-of-the-beholder-ly yours,

	Oren




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4