wormwood_3 wrote:
> 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?

It's nothing special, just a name. The first line should be
   append_ = self.potdomains.append

using the underscore just signals that this is an alias for the 'real' 
append method. You don't have to use it.

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to