On 09.10.2009 09:50, TK Soh wrote: > On Fri, Oct 9, 2009 at 7:32 AM, Adrian Buehlmann <adr...@cadifra.com> wrote: >> On 09.10.2009 04:32, Steve Borho wrote: >>> On Thu, Oct 8, 2009 at 9:10 PM, Yuki KODAMA <endflow....@gmail.com> wrote: >>>> On Fri, Oct 9, 2009 at 11:00, TK Soh <teekay...@gmail.com> wrote: >>>>> On Thu, Oct 8, 2009 at 6:57 PM, Steve Borho <st...@borho.org> wrote: >>>>>> FYI >>>>>> >>>>>> I realized today that we need to explicitly 'return False' from all of >>>>>> our >>>>>> idle_add() callback routines. >>>>>> If the return result evaluates as True, the callback will be called >>>>>> endlessly. >>>>> I haven't checked, but it's not documented in PyGTK doc? >>>> Documented: >>>> "If callback returns FALSE it is automatically removed from the >>>> list of event sources and will not be called again." >>>> http://pygstdocs.berlios.de/pygobject-reference/glib-functions.html#function-glib--idle-add >>> I did verify this by taking a callback and adding a print and >>> returning True.. it gets called hundreds of time per second. >>> >>>> After all, for safety, we should return False explicitly. >>> 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 think it's any more work or confusion than working with any > API. It falls within users' responsibility to understand and comply to > the API's requirement. No offense to Steve, but I'd classify it as a > user's fault to not return False as prescribed by idle_add's document. > > IMO, if returning False is not a good idea, then just file a bug to PyGTK > team. > >> We could package my approach in a function for example in >> hgtk.gtklib: > > I feel it's a little overkills. >
Ok. No problem. It was just an idea. ------------------------------------------------------------------------------ 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