Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.python
Re: Constraints on __sub__, __eq__, etc.
Robert Kern
2/18/2010 4:40:00 PM
On 2010-02-18 10:19 AM, Andrey Fedorov wrote:
> It seems intuitive to me that the magic methods for overriding the +, -,
> <, ==, >, etc. operators should have no sideffects on their operands.
> Also, that == should be commutative and transitive, that > and < should
> be transitive, and anti-commutative.
>
> Is this intuition written up in a PEP, or assumed to follow from the
> mathematical meanings?
Some of it is covered in the reference manual. E.g.
http://docs.python.org/reference/datamodel.html#obj...
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: Constraints on __sub__, __eq__, etc.
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password