Adrian Buehlmann <adr...@cadifra.com> writes:

> On 10.10.2009 19:30, Martin Geisler wrote:
>> Adrian Buehlmann <adr...@cadifra.com> writes:
>> 
>>> On 09.10.2009 04:32, Steve Borho wrote:
>>>
>>>> The wrapper class Adrian suggested feels too heavy weight. A lambda
>>>> wouldn't be too bad, but simply returning False I feel would be the
>>>> most clear. It's good to know Python is saving us from obvious bugs.
>>> IMHO, adding 'return False' randomly in functions that happen to be
>>> used in idle_add is confusing and suboptimal for maintenance.
>>
>> I don't understand why you think one needs to add it "randomly" to
>> functions. You only need to add it for functions used as callbacks
>> and only in the case where the callback also occasionally returns
>> True. That's not confusing --- it's a very straight forward API,
>> IMHO.
>>
>> I just grepped through the source and looked at all the occurrences
>> of idle_add. As far as I can tell, there are only a few places where
>> a callback function "return True" to signal that it should be run
>> again.
>
> Your post is highly confusing for me.

Oh, that was not the purpose :-) I'm confused myself why you see this as
a problem -- it looks like a misunderstanding to me. It started with
Steve thinking that one must explicitly return False from all callback
functions. He later discovered that Python functions return None when
execution reaches the end.

I expected the discussion to stop there since from that point on it
should be clear that there's no problem: if the function you want to use
as a callback can return both True and False, I believe you'll want to
do something depending on that return value and not just throw it away.
That in turn means that it's wrong to use it directly as a callback.

But perhaps you're thinking of function which both had side-effects and
return a value? Like dict.pop, which you might want to call for its
side-effect only.

> Does that make sense?

Yes, I believe I understand what you're trying to achieve.

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.

Attachment: pgprdAaPRKDmY.pgp
Description: PGP signature

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to