[Python-checkins] r81706 - in python/trunk: Lib/test/test_descr.py Objects/abstract.c

Benjamin Peterson benjamin at python.org
Sat Jun 5 20:55:09 CEST 2010


2010/6/5 Nick Coghlan <ncoghlan at gmail.com>:
> On 05/06/10 10:32, benjamin.peterson wrote:
>>
>> -    /* Initialize cached value */
>> -    if (str__format__ == NULL) {
>> -        /* Initialize static variable needed by _PyType_Lookup */
>> -        str__format__ = PyString_InternFromString("__format__");
>> -        if (str__format__ == NULL)
>> -            goto done;
>> -    }
>> -
>
> Why kill the microoptimisation here? Looking the string up in the intern
> dict every time (as these changes do) is a waste of cycles. Since avoiding
> it is pretty easy using this common idiom, it's generally worth doing.

Yes, but that's only applicable to classic classes, which I can't say
I care much about.



-- 
Regards,
Benjamin


More information about the Python-checkins mailing list