Μετάβαση στο κύριο περιεχόμενο
🔒 Λειτουργία προεπισκόπησης. Τα πρώτα δεκαπέντε μαθήματα Foundations είναι δωρεάν· αυτό είναι Pro. Ξεκινήστε ένα 7ήμερο trial για να ξεκλειδώσετε τον επεξεργαστή, τις υποδείξεις AI και το υπόλοιπο του προγράμματος. Απαιτείται κάρτα, ακυρώνετε οποιαδήποτε στιγμή από το Dashboard.Ξεκινήστε 7ήμερο trial →
← ΜαθήματαSenior Deep-DivesModule 1 · Concurrency internals · RecapΠροβολές μνήμης και πρωτόκολλο bufferpredict32 / 161
+100 XP
Εργασία🌐 shown in EN
📝 **Question:** Predict the exact output. \`mv = memoryview(data)\` is a zero-copy WINDOW into the bytearray. Then \`slice_view = mv[0:5]\` is a smaller window into the SAME buffer. The question: does writing through \`slice_view\` change \`data\`? 📋 Pick the right answer. 💡 **Hint:** Re-read the theory above if unsure.
Πρόβλεψε έξοδο

Διάβασε τον κώδικα προσεκτικά

data = bytearray(b"hello world")
mv = memoryview(data)
print(f"original:{data.decode()}")

mv[6:11] = b"PYTHN"
print(f"after_view_write:{data.decode()}")

slice_view = mv[0:5]
print(f"slice:{bytes(slice_view).decode()}")

slice_view[0] = ord("H")
print(f"data_now:{data.decode()}")
print(f"mv_view:{bytes(mv).decode()}")

Τι θα εμφανίσει το πρόγραμμα; Γράψε εδώ: