Pre-PEP: Refusing to guess in string formatting operations

Alex Martelli aleax at aleax.it
Wed Mar 12 12:55:36 EST 2003


Michael Hudson wrote:

> Jp Calderone <exarkun at intarweb.us> writes:
> 
>>   In retrospect, I would rather have the method named __mod__.  It is the
>> only thing that -really- makes sense, and it clears up two related warts:
>> using the % operator on strings calls no function reachable from Python,
>> and subclasses of str cannot override the % behavior.
> 
> This is fixed in 2.3, I'm fairly sure.

Yep -- a % b does indeed call type(a).__mod__(b) in Python 2.3.


Alex





More information about the Python-list mailing list