class inheritance

JLundell jlundell at pobox.com
Thu Mar 18 19:01:18 CET 2010


On Mar 17, 5:12 pm, Steven D'Aprano
<ste... at REMOVE.THIS.cybersource.com.au> wrote:
> On Mon, 15 Mar 2010 16:34:35 -0700,JLundellwrote:
> > It's also unfortunate that Python doesn't have an approximately-equal
> > operator; it'd come in handy for floating-point applications while
> > preserving hash. If only there were a ~= or ≈ operator I could overload.
> > And ~ is unary, so no joy.
>
> Not everything needs to be a built-in, or an operator. This might be
> useful for you:
>
> http://code.activestate.com/recipes/577124-approximately-equal/
>
> Feedback welcome.
>
> --
> Steven

Thanks, Steven. I'd considered and rejected that a while ago, but on
reconsideration it's sounding like a better idea. Aside from
preserving the semantics of =, it makes the use of approximate
equality explicit in the code, and that's a plus for what I'm doing.
I'll give it a shot.



More information about the Python-list mailing list