How do I add two integers together with Twisted?

后端 未结 3 1042
不思量自难忘°
不思量自难忘° 2021-01-30 04:16

I have two integers in my program; let\'s call them \"a\" and \"b\". I would like to add them together and get another integer as a result. These are

3条回答
  •  我在风中等你
    2021-01-30 04:42

    OK, to be clear.

    Twisted doesn't do anything about cpu bound tasks and for good reason. there's no way to make a compute bound job go any quicker by reordering subtasks; the only thing you could possibly do is add more compute resources; and even that wouldn't work out in python because of a subtlety of its implementation.

    Twisted offers special semantics and event loop handling in case the program would become "stuck" waiting for something outside if its control; most normally a process running on another machine and communicating with your twisted process over a network connection. Since you would be waiting anyways, twisted gives you a mechanism to get more things done in the meantime. That is to say, twisted provides concurrency for I/O Bound tasks

    tl;dr: twisted is for network code. Everything else is just normal python.

提交回复
热议问题