与收益相反? [英] Opposite of yield?

查看:86
本文介绍了与收益相反?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



yield语句看起来是迈向python中某种轻量级并发编程的一大步。有没有

任何类似的好方法来做与收益相反的做法,只需坐在

(可能在循环中间)并等到其他一些例程

(等待模块不知道)投入一个值?


如果现在没有实现,那么它是否有可能在

要列出的事项清单?

Al


The yield statement looks to be a big step toward some kind of
lightweight concurrency-oriented programming in python. Is there
any similarly nice way to do the opposite of yield, just sit around
(perhaps in the middle of a loop) and wait until some other routine
(unknown to the waiting module) hurls a value in?

If this is not implemented now, is there any chance that it''s on the
list of things to come?
Al

推荐答案

ac ***** @ easystreet.com 写道:
yield语句看起来朝着某种
python中的轻量级并发编程。是否有任何类似的好方法与屈服相反,只需坐在
(可能在循环中间)并等到其他一些例程
(等待模块未知)投入一个价值?

如果现在没有实现,那么它是否有可能出现在
列表中?
The yield statement looks to be a big step toward some kind of
lightweight concurrency-oriented programming in python. Is there
any similarly nice way to do the opposite of yield, just sit around
(perhaps in the middle of a loop) and wait until some other routine
(unknown to the waiting module) hurls a value in?

If this is not implemented now, is there any chance that it''s on the
list of things to come?




机会不大。即使Stackless也不能再这样做了,如果我正确理解的话。



Not much chance. Even Stackless can''t do that any more, if I
understand correctly.


ac ***** @ easystreet.com 写道:
ac*****@easystreet.com wrote:
yield语句看起来朝着某种方式迈出了一大步在python中使用轻量级并发编程。是否有任何类似的好方法与屈服相反,只需坐在
(可能在循环中间)并等到其他一些例程
(等待模块未知)投入价值?
The yield statement looks to be a big step toward some kind of
lightweight concurrency-oriented programming in python. Is there
any similarly nice way to do the opposite of yield, just sit around
(perhaps in the middle of a loop) and wait until some other routine
(unknown to the waiting module) hurls a value in?




是的:


generator.next()


-

Erik Max Francis&& ma*@alcyone.com && http://www.alcyone.com/max/

__美国加利福尼亚州圣何塞市&& 37 20 N 121 53 W&& & tSftDotIotE

/ \死人没有胜利。

\ __ / Euripides



Yep:

generator.next()

--
Erik Max Francis && ma*@alcyone.com && http://www.alcyone.com/max/
__ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/ \ Dead men have no victory.
\__/ Euripides


在01 :2003年9月10日下午4点, ac*****@easystreet.com 写道:

At 01:40 PM 9/10/2003, ac*****@easystreet.com wrote:

yield语句看起来是迈向python中某种轻量级并发编程的重要一步。是否有任何类似的好方法与屈服相反,只需坐在
(可能在循环中间)并等到其他一些例程
(等待模块未知)投入一个值?
The yield statement looks to be a big step toward some kind of
lightweight concurrency-oriented programming in python. Is there
any similarly nice way to do the opposite of yield, just sit around
(perhaps in the middle of a loop) and wait until some other routine
(unknown to the waiting module) hurls a value in?




对于休眠一段时间然后检查数据的线程来说,这听起来像是一个任务。


也让人想起(很久以前)有人提出了一个COME FROM声明

FORTRAN与GO TO相反。


也许是一个新的Python声明 ;吮吸?


Bob Gailer
bg ***** @ alum.rpi.edu

303 442 2625

---

外发邮件已通过无病毒验证。

由AVG反病毒系统检查( http://www.grisoft.com)

版本:6.0.506 /病毒库:303 - 发布日期:2003年8月1日



Sounds like a task for a thread that sleeps a while then checks for the data.

Also reminiscent (a long time ago) someone proposed a COME FROM statement
for FORTRAN to be the inverse of GO TO.

Perhaps a new Python statement "suck"?

Bob Gailer
bg*****@alum.rpi.edu
303 442 2625
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.506 / Virus Database: 303 - Release Date: 8/1/2003


这篇关于与收益相反?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆