Re:Brython – A Python 3 implementation for client-side web p...
by duckerude on Monday July 06, 2020 @09:48AM
(#23747800)
Overloading comparison operators like this is a particularly bad idea in Python, because of the "smart" behavior they have baked in. Overloading >> is comparatively safe.
Unless you implement __ge__, `'Hello!' >= document` will also call __le__, which may or may not be what you want. And `'Hello!' >= document <= 10` is equivalent to `'Hello!' >= document and document <= 10`, which can lead to confusing surprises.
(Brython does implement all of those pitfalls faithfully)
Unless you implement __ge__, `'Hello!' >= document` will also call __le__, which may or may not be what you want. And `'Hello!' >= document <= 10` is equivalent to `'Hello!' >= document and document <= 10`, which can lead to confusing surprises.
(Brython does implement all of those pitfalls faithfully)