[Python-Dev] I think my set module is ready for prime time; comments?

Paul Prescod paulp@ActiveState.com
2001年1月24日 08:56:26 -0800


Guido van Rossum wrote:
>>...
>> > Cool idea, but even cooler (would catch more idioms, that is) is
> > "the first time someone stores something not 'is' something in the
>> Sorry, but I don't understand what you mean by the ^^^ marked phrase.
> Can you please elaborate?

I wasn't clear about that either. The idea is:
def add(new_value):
 if not values_array:
 if self.magic_value is NULL:
 self.magic_value = new_value
 elif new_value is not self.magic_value:
 self.values_array=[self.magic_value, new_value, ... ]
 else:
 # new_value is self.magic_value: do nothing
I am neutral on this proposal myself. I think that even if we optimize
any code where you pass the same thing over and over again, we should
document a convention for consistency. So I'm not sure there is much
advantage.
 Paul Prescod

AltStyle によって変換されたページ (->オリジナル) /