[Tutor] Loop optimization

wormwood_3 wormwood_3 at yahoo.com
Sat Sep 15 22:21:34 CEST 2007


Kent,

You replied with the following some time ago regarding a question I asked about optimizing a loop:

>> You should try an optimized for loop:
>>                      append_ = self.potdomains.append_
>>                      s1_ = suffix1
>>                      s2_ = suffix2
>>                      for word in self.dictcontents:
>>                          append_(word + s1_)
>>                          append_(word + s2_)
>> 
>> This will take out some of the difference at least.


I realized when reviewing this that I do not know what the "NAME_" notation is about. I know that "_METHOD/ATTR" makes a method or attribute private to an instance, but what does the trailing underscore do?

Thanks,
Sam





More information about the Tutor mailing list