Am 14.06.20 um 14:56 schrieb Alex Hall:
> It would help a lot if you could show some examples. 

There you go:

> ```python
> 
> import math
> a = 1.0000000001
> b = 0.9999999999
> 
> print( a == b ) # prints "False"
> print( math.isclose(a, b) ) # prints "True"
> 
> class demo(float):
>     # this could actually become `__ce__` or similar:
>     def __mod__(self, other: float) -> bool:
>         return math.isclose(self, other)
> 
> ad = demo(a)
> bd = demo(b)
> 
> print( ad == bd ) # prints "False" as before
> 
> # this could actually become `ad ~= bd` or similar:
> print( ad % bd ) # prints "True"
> 
> ```

I hope this helps.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/6HM6YBG2KVFQ2CTICA2KV2J2BCHAVY7V/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to