Multi thread reading a file

Gabriel Genellina gagsl-py2 at
Thu Jul 2 23:47:54 EDT 2009

En Fri, 03 Jul 2009 00:15:40 -0300, <// at nospam.invalid>> escribió:

> ryles <rylesny at> writes:
>> >    sentinel = object()
>> I agree, this is cleaner than None. We're still in the same boat,
>> though, regarding iter(). Either it's 'item == None' or 'item == object  
>> ()'
> Use "item is sentinel".

We're talking about the iter() builtin behavior, and that uses ==  

It could have used an identity test, and that would be better for this  
specific case. But then iter(, '') wouldn't work. A  
compromise solution is required; since one can customize the equality test  
but not an identity test, the former has a small advantage. (I don't know  
if this was the actual reason, or even if this really was a concious  
decision, but that's why *I* would choose == to test against the sentinel  

Gabriel Genellina

More information about the Python-list mailing list