Builtin Float Epsilon? (was: Re: Does python suck or I am just stupid? )

Erik Max Francis max at alcyone.com
Sat Feb 22 23:15:39 EST 2003


Jonathan McLin wrote:

> another dynamic language I've used provides the '~=' operator
> precisely for
> this purpose (pun intended).
> 
> So with real numbers, you use 'if u~=v:'
> 
> PEP?  'a ~= b' operator equivalent to 'a-epsilon <= b <= a+epsilon'

An obvious problem with the idea is that ~ is an entirely unrelated
operator.  Given that Python 2.x supports augmented assignment, this is
undoubtedly going to cause some confusion (even though ~ is a unary
operator and thus there is no augmented ~= assignment operator).

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ And your daddy died for you / And I'll do the same
\__/ India Arie
    Crank Dot Net / http://www.crank.net/
 Cranks, crackpots, kooks, & loons on the Net.




More information about the Python-list mailing list