[Python-ideas] [Python-Dev] The Case Against Floating Point ==

Neil Toronto ntoronto at cs.byu.edu
Fri Mar 14 08:29:45 CET 2008


Tiago A.O.A. wrote:
> I would suggest something like a ~= b, for "approximately equal to". How 
> approximately? Well, there would be a default that could be changed 
> somewhere.
> 
> Don't know if it's all that useful, though.

Don't forget a !~ b, a <~ b, and a >~ b, and the associated __sim__, 
__nsim__, __ltsim__, and __gtsim__ slots.

I'm not at all sure how serious I am right now. It's late, and I have 
fuzzy recollections of how those kinds of things might have been nice in 
some past numerical code.

And then =~ and !~ could be defined for strings and do regular 
expression matching! Woo! More operators! With pronouns!

Neil



More information about the Python-ideas mailing list