Chúng tôi không thể tìm thấy kết nối internet
Đang cố gắng kết nối lại
Có lỗi xảy ra!
Hãy kiên nhẫn trong khi chúng tôi khắc phục sự cố
Cách biến hoạt động trong Python | Giải thích bằng hình ảnh động
Tóm tắt nội dung
Mô tả
This video tries to explain how variables or name bindings work in Python and their internal representations like PyObject and PyVarObjects, using animations.
Intermediate level concepts like reference counting, garbage collection, how lists work internally, why python is a dynamically typed language, interning, None objects, equality operators like '==' and 'is', how 'del' works, how variables are passed into functions(pass by reference), issues with default mutable parameters, operator overloading and behaviour of augmented arithmetic assignment operators, the behaviour of mutable element in the tuple are also explained.
It also shows how mutable and immutable data types behave differently in some scenarios. This knowledge should be useful for people coming from other languages like C, Rust, or Golang and may enable them to write better Python code.
References
------------------
comments in CPython source code: https://github.com/python/cpython/blob/f572cbf1faab33d9afbbe3e95738ed6fbe6e48e6/Include/object.h#L9
Chapters
---------------
0:00 How variables works in C
1:05 How variables works in Python
3:55 How lists are represented internally
6:57 Interning
8:55 Equality operators
10:15 Pass by reference to functions
11:44 Mutable default parameters
14:12 Augmented arithmetic assignment operators
16:06 Mutable elements in Tuple
Dịch Vào Lúc: 2025-07-06T11:48:43Z