Why can't I xor strings?

Brian Quinlan brian at sweetapp.com
Mon Oct 11 16:35:28 CEST 2004


Grant Edwards wrote:
>>One of the greatest sources of usefulness for 'and' and 'or' is exactly
>>that these operators _don't_ coerce their operands
> 
> 
> Surely they must coerce the operands for the "test" part if not
> for the "return" part.

Is calling a method cosidered coercing? The "test" part must call the 
object's __nonzero__ method but no Python boolean object is ever created.

Cheers,
Brian




More information about the Python-list mailing list