Python 3 id() built-in function TUTORIAL

preview_player
Показать описание
Tutorial on how to use the id() built-in function from the Python 3 Standard Library.

📖 You can check out the Udemy course (Python Built-in Functions) here:

Documentation:

⚙️ Recommended Computer Gear:

✈️ Recommended Digital Nomad Gear:
Рекомендации по теме
Комментарии
Автор

3:33 what Python does behind the scenes is cache the integers ranging from -5 to 256 (inclusive) because they are used so often -> having them in memory increases performance! The Python interpreter creates those small int objects on startup. Objects for integers outside that range are created when you assign those integers to a variable, creating a new object in memory every time, which is why the id differs in those cases

felixvanderspek