Spurious coercing? [was: Re: 'if foo' calls getattr?!?]
Moshe Zadka
moshez at math.huji.ac.il
Tue Jun 6 13:46:57 EDT 2000
On 6 Jun 2000, [ISO-8859-1] François Pinard wrote:
> And I would presume that if __cmp__ happened to be found, a call to
> __coerce__ would be tried before going any further?
Yes, indeed. The reason is that Python tries very hard *not* to be smart:
the opposite of smart, in this case, being predictable. If you know
__coerce__ is always called before binary operators take place, your code
can be that much simpler.
--
Moshe Zadka <moshez at math.huji.ac.il>
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com
More information about the Python-list
mailing list