yield
yield是什么意思,
yield怎么讀
語音:
英音
[ji:ld]
美音 [jild]
vt. 屈服,投降;生產(chǎn);獲利;不再反對
vi. 放棄,屈服;生利;退讓,退位
n. 產(chǎn)量,產(chǎn)額;投資的收益;屈服,擊穿;產(chǎn)品
在編程中,'yield'是一個關(guān)鍵字,通常用于生成器(generator)函數(shù)。生成器是一種特殊類型的函數(shù),它在執(zhí)行過程中可以暫停和恢復(fù),而不需要像普通函數(shù)那樣一次性加載所有代碼。'yield'關(guān)鍵字用于暫停函數(shù)的執(zhí)行,并返回一個值,這個值可以在后續(xù)的迭代中再次使用。當(dāng)生成器函數(shù)再次被調(diào)用時,它會從上次暫停的地方繼續(xù)執(zhí)行,直到再次遇到'yield'關(guān)鍵字。這種機(jī)制允許生成器函數(shù)在內(nèi)存使用上更加高效,因?yàn)樗鼈兺ǔV恍枰4娈?dāng)前狀態(tài),而不是整個函數(shù)代碼。
【記】“又得”→又得到了很多→出產(chǎn)很多產(chǎn)品。
復(fù)數(shù): yields
第三人稱單數(shù): yields
過去式: yielded
過去分詞: yielded
現(xiàn)在分詞: yielding
yield 出產(chǎn),屈服
來自PIE*gheldh,支付,付款,引申詞義屈服,詞源同guild.其原義為加入行業(yè)公會,獲取行業(yè)保護(hù),引申詞義出產(chǎn),收獲。
用作動詞(v.)
- The village abounds in fields that yield many bushels of corn.
那個村莊到處都是盛產(chǎn)玉米的農(nóng)田。 - The combined investment is expected to yield $5,000 in the first year.
第一年該總投資有望獲利5000美元。 - We' ve already made it clear that we will not yield to pressure.
我們已經(jīng)表明我們不會屈服于壓力。 - The shelf is beginning to yield under that heavy weight.
架子被那么大的重量壓得彎了下去。
用作名詞(n.)
- So if the share price rises and the dividend does not, then the yield falls.
因此,如果股份上漲而股息不變,收益就下跌。 - Wheat yields doubled last year.
去年小麥產(chǎn)量翻了一番。
"yield from":這個短語表示從一個生成器對象中獲取值,直到生成器結(jié)束。
"yield statement":這個短語表示在Python中用于暫停和恢復(fù)函數(shù)或生成器的語句。
"yield expression":這個短語表示在Python中用于生成值的表達(dá)式,它類似于函數(shù)中的yield語句,但可以在表達(dá)式中使用。
"yield from":這個短語用于從一個生成器或迭代器中獲取多個值。
以上是貝語網(wǎng)校http://www.hefrebsx.cn小編為您整理的yield單詞相關(guān)內(nèi)容。