[Twisted-Python] inlineCallbacks as a blocking approximator (stylistic)

Oon-Ee Ng ngoonee.talk at gmail.com
Tue Oct 4 00:21:55 MDT 2016


On Tue, Oct 4, 2016 at 1:03 PM, Manish Tomar <manish.tomar at gmail.com> wrote:
> I was on synchronous mindset before learning Twisted and did not
> like/understand Deferred. The `yield` based statement really helped me
> initially but more importantly over time I liked seeing an explicit
> difference between blocking vs non-blocking code. When I see `a =
> yield func()`, I immediately register the fact that this is a
> time-consuming operation which helps in understanding the performance
> of the system. So, yes it is a good start for synchronous mindset
> people.


Actually I really like the idea behind deferred, its just not the
easiest to read and understand for others, and I don't want to be the
only one maintaining my code.

That being said 'yield=time-consuming' doesn't make sense to me. I'm
using twisted (and AMP) for communication, not to offload processing,
and some of the operations would be near-instant in a threaded context
(obviously with the reactor running it has to wait till it gets picked
up).




More information about the Twisted-Python mailing list