版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
Functiontransferparameters2learningtasksUnderstandtheessenceofPythonpassingparameters.3KnowledgeobjectivesUnderstandPythontypeownershipUnderstandingtheessenceofPythonparameterpassing01abilityobjectivesAbilitytodistinguishbetweenmutableandimmutableobjectsBeabletoexplainPythonparameterpassingprocess02Learningobjectives4typerelationInPython,thetypebelongstotheobjectandthevariablehasnotype.Asfollows:a=[1,2,3]a=“Python”Where[1,2,3]isoftypelist,Pythonisoftypestring,andvariableahasnotype.Itisonlyareferenceoftheobject,whichcanbeanobjectoftypelistoraobjectoftypestring.5VariabletypeandimmutabletypeconceptEveryobjectinPythonisdividedintomutableobjectandimmutableobject.Inthemaincoretypes,numbers,stringsandtuplesareimmutable,andlistsanddictionariesarevariable.6VariabletypeessenceIfitismutable,whenyouoperateonanobject,youdonotneedtoapplyformemoryinotherplaces.Youonlyneedtoapply(+/-)continuouslyaftertheobject,thatis,itsaddresswillremainunchanged,buttheareawillbecomelongerorshorter.Forexample,assignLa=[1,2,3,4]tovariableLa,andthenassignLa[2]=5.Atthistime,onlythethirdelementvalueoflistLaischanged.Laitselfdoesnotmove,butonlyapartofitsinternalvalueismodified.7immutabletypeessenceThevariabletypedependsonwhetherthevalueofthememoryunitcanbechanged.Ifitisimmutable,whenoperatingontheobjectitself,youmustapplyforanothermemoryunitinanotherplaceofmemory,andtheoldmemoryunitwillbediscarded.Forexample,assigna=5tovariablea,andthenassigna=10.Thisprocessactuallygeneratesanewintegerobject10,pointsatoit,anddiscards5.Thisisnottochangethevalueofa,buttogenerateanewone.8ParameterpassingessenceInPython,everythingisanobject.Strictlyspeaking,wecan'tsayvaluepassingorreferencepassing.Weshouldsaypassingimmutableobjectsandpassingmutableobjects.Immutableobject:similartovaluepassing,suchasinteger,string,tuple.Forexample,fun(a)passesonlythevalueofa,withoutaffectingtheobjectitself.Forexample,ifyoumodifythevalueofainfun(a),youcanonlymodifyanothercopiedobject,withoutaffectinga.Variabletype:similartoreferencepassing,suchaslist,dictionary.Forexample,fun(LA)istherealtransmissionofLa.Afterinternalmodification,theexternalLaoffunwillalsobeaffected9PythonParameterpassingexample10Taskimplementation11Operationdemonstration12Summaryofknowledgepoin
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 安徽省重點(diǎn)中學(xué)2025年高三下學(xué)期第三次質(zhì)量考評生物試題含解析
- 安徽省太和縣民族中學(xué)2025年高三5月畢業(yè)班模擬考試生物試題含解析
- 安徽亳州利辛金石中學(xué)2025年高三綜合模擬金卷(1)生物試題試卷含解析
- 七年級信息技術(shù)上冊 第3課 鍵盤操作教案設(shè)計(jì)
- 廣東省肇慶市高中地理 第三章 農(nóng)業(yè)地域的形成與發(fā)展 3.2 以種植業(yè)為主的農(nóng)業(yè)地域類型(1)教案 新人教版必修2
- 八年級語文下冊 勤奮好學(xué) 第十課 為你打開一扇門 第五課時(shí) 自讀課文教案 新教版(漢語)
- 2025年云南省華寧一中高三年級下學(xué)期十月份月考生物試題含解析
- 2025年四川省攀枝花市重點(diǎn)中學(xué)高三全真模擬(最后一卷)生物試題試卷含解析
- 2025年上海市華東師大一附中高三下學(xué)期3月月考生物試題試卷含解析
- 滌綸DTY相關(guān)項(xiàng)目創(chuàng)業(yè)計(jì)劃書
- 2024美國電商市場報(bào)告
- Unit 2 Great People 教學(xué)設(shè)計(jì)2024-2025學(xué)年冀教版英語九年級上冊
- 遼寧省2024年中考數(shù)學(xué)試卷
- 2024年安徽滁州定遠(yuǎn)縣部分事業(yè)單位選調(diào)工作人員7人歷年高頻考題難、易錯(cuò)點(diǎn)模擬試題(共500題)附帶答案詳解
- 班主任能力大賽情景答辯環(huán)節(jié)真題及答案高中組
- 有限空間(污水池)清池作業(yè)事故應(yīng)急演練方案
- 《二十屆三中全會(huì)》重要試題附答案
- 2024年12123交管駕駛證學(xué)法減分題庫和參考答案
- 2024-2030年中國寵物醫(yī)療市場產(chǎn)業(yè)消費(fèi)需求及盈利前景預(yù)測報(bào)告
- 2024年甘肅省金昌市消防救援支隊(duì)招聘消防文員3人歷年(高頻重點(diǎn)復(fù)習(xí)提升訓(xùn)練)共500題附帶答案詳解
- 中國高血壓防治指南(2024年修訂版)核心要點(diǎn)解讀
評論
0/150
提交評論