<br><br><div><span class="gmail_quote">On 3/6/07, <b class="gmail_sendername">Ka-Ping Yee</b> <<a href="mailto:firstname.lastname@example.org">email@example.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Tue, 6 Mar 2007, Neil Schemenauer wrote:<br>> The argument that all "protocol" methods should have double<br>> underscore names seems to be pretty weak too. It's only an appeal<br>> for consistency, I think. We don't suggest that file-like objects
<br>> should implement __read__() instead of read(), for example.<br><br>There is a convention and it is applied quite consistently:<br><br> Double-underscores are for methods implicitly invoked<br> by a language construct.
</blockquote><div><br>I believe you misinterpret the convention. Rather, as I see it, it is:<br> <br></div> Double-underscores are for methods implicitly invoked<br> by a language construct, and should not be called
<br> directly on foreign objects.<br><br>(So perhaps it's not much of a convention, if we can't agree on it :) The __*__ methods can be seen as a private API. 'next' is not part of it. I see no problem what so ever with the interpreter calling a non-underscored function. I do not understand why this is a problem.
<br><br>I'm -1 on the change. I would be -0 (*maybe* +0) if I thought we had a chance in hell of doing this migration gracefully, but we don't. The translator can't really handle all the cornercases we currently have. The best we can do is *add* a __next__ method to classes that have a next method but no __next__ method, and I simply do not think that's worth it. I am not convinced there is an *actual problem* we are solving, other than that some people are confused about the current situation. Other people would be confused if it was different, so I do not subscribe to the validity of that argument. The single reason I like the builtin next() is the two-argument version, which is quite similar to the two-argument iter(). I would prefer adding it *without* renaming .next to .__next__.
<br></div><br>-- <br>Thomas Wouters <<a href="mailto:firstname.lastname@example.org">email@example.com</a>><br><br>Hi! I'm a .signature virus! copy me into your .signature file to help me spread!