I use closures unless I use the same callback all the time. On Apr 2, 2013 1:04 PM, "Hynek Schlawack" <h...@ox.cx> wrote:
> Hi, > > I’ve asked this one already at the Twisted dinner (thanks again for it, it > was probably my PyCon highlight) and got various answers from people > sitting around me. I’m still indecisive so I’d like to gather even more > opinions[1]. I already tried to ask on IRC but my time zone is just not > very #twisted friendly so I got zero replies. > > My question can be simplified to: Closures yes or no? > > They seem *really* handy since they allow to have some data present > without handing it through all the time. Eg in my cred checker, I can refer > to the user name from the closure instead of passing it around all the time > – making the code much cleaner. Also most current examples and > callbacks-are-hard-FUD-rebuttals seem to use them. > > OTOH, private methods like `_cbPrintResult` are nicer to test individually. > > If “yes, closures”: Still using cb/eb prefixes? I don’t see them very > often in recent examples. What about addBoth handlers? > > Bonus points for the preferred style for the Twisted code base. > > Thanks in advance & thank you for your time, > Hynek > > [1]: I’d be glad if people from the dinner replied again too so I/we have > it in written form, my memory tends to be rather sloppy. > _______________________________________________ > Twisted-Python mailing list > Twisted-Python@twistedmatrix.com > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python >
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python