On Sun, Mar 26, 2006, Raymond Hettinger wrote:
> [Alex]
>>
>>  And I'm on the fence regarding the specific issue  of PySet_Next.
>>
>> So, having carefully staked out a position smack in the middle, I
>> cheerfully now expect to be fired upon from both sides!-)
> 
> Okay, here's the first cheap shot ;-) Which of the following pieces of
> code is preferable?  The first loops with the iterator protocol and
> the second loops with the _next protocol.

Speaking as a person who does relatively little C programming, I don't
see much difference between them.  The first example is more Pythonic --
for Python.  I agree with Barry that it's not much of a virtue for C
code.

However, I do have one nitpick with both your examples; I don't know
whether this is an artifact of them being examples:

>                 hash ^= h * 3644798167;

Seems to me that magic numbers like this need to be made constants and
explained with a comment.
-- 
Aahz ([EMAIL PROTECTED])           <*>         http://www.pythoncraft.com/

"Look, it's your affair if you want to play with five people, but don't
go calling it doubles."  --John Cleese anticipates Usenet
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to