Puas muaj npe tuples mutable?
Puas muaj npe tuples mutable?

Video: Puas muaj npe tuples mutable?

Video: Puas muaj npe tuples mutable?
Video: Python! Tuples 2024, Hlis ntuj nqeg
Anonim

Xav tias daim ntawv lo, tsis yog lub thawv. Python tuples muaj qhov xav tsis thoob: lawv hloov tsis tau, tab sis lawv cov txiaj ntsig tuaj yeem hloov pauv. Qhov no yuav tshwm sim thaum a tuple tuav ib tug siv rau tej hloov tau khoom, xws li daim ntawv teev npe.

Hauv qhov no, dab tsi yog lub npe tuples?

npe tuples yog qhov yooj yim-rau-tsim, lub teeb yam khoom hom. npe tuple piv txwv tuaj yeem siv tau siv cov khoom zoo li qhov sib txawv ntawm qhov sib txawv los yog tus qauv tuple syntax. Lawv tuaj yeem siv tau zoo sib xws rau cov qauv lossis lwm hom ntaub ntawv, tshwj tsis yog tias lawv hloov tsis tau.

yog tuples mutable C#? Txij li thaum tuples yog structs tsis muaj ntau qhov taw tes ua rau lawv hloov tsis tau. Qhov kawg tshwm sim - C# cov yog cov teeb pom kev zoo heev - lawv yog cov qauv thiab lawv cov ntsiab lus yog hloov tau thiab ncaj qha chaw nyob.

Nyob rau hauv txoj kev no, dab tsi yog mutable counterparts ntawm tuples?

Net cov Tuple chav kawm yog hloov tsis tau (txawm hais tias ib qho ntawm nws cov ntsiab lus yog hom siv, koj tseem tuaj yeem nkag mus rau lawv cov khoom). “ Mutable counterparts ” hauv koj cov lus programming yuav yog ib qho 1-dimensional array (vector), cov npe lossis cov ntawv sau zoo sib xws uas tso cai nyeem thiab sau ntawv nkag mus rau nws cov ntsiab lus.

Cov npe puas tuaj yeem hloov tau?

Cov npe yog hloov tau cov khoom uas txhais tau tias koj tuaj yeem hloov kho a lis khoom tom qab nws tau tsim. Tuples ntawm qhov tod tes yog cov khoom hloov tsis tau uas txhais tau tias koj tsis tuaj yeem hloov kho cov khoom tuple tom qab nws tau tsim.

Pom zoo: