+ 11

Why int(str(i)) had this big impact on location of int variable in memory⁉️🤔

I read in 🐍 doc that 🐍 in order to optimize memory, int variables in the range(-5, 256+1) stores in the same place. Observe the beginning & the end of the range. What role does int(str(i)) play? This operation is somewhat artificial because "i" is integer type. Kuba Siekierzyński BroFarOps 👑 🌟Prometheus 🇸🇬 John Wells David Carroll https://code.sololearn.com/c3usQsVh785Y/?ref=app

3rd Dec 2019, 6:02 PM
Janusz Bujak 🇵🇱 🇺🇦
Janusz Bujak 🇵🇱 🇺🇦 - avatar
2 ответов
+ 1
this article actually does a fairly good explanation as it tosses int(str(I)) around changing locations in the memory https://medium.com/@birnbera/objects-memory-and-mutation-in-JUMP_LINK__&&__python__&&__JUMP_LINK-810bf090b63c stackoverflow also has a very good explanation of why you would use this methodology https://stackoverflow.com/a/28864111/7218253
3rd Dec 2019, 6:28 PM
BroFar
BroFar - avatar
+ 11
BroFarOps 👑 Thanks a lot for the links. Medium article is really very interesting ‼️☺️ https://code.sololearn.com/che8Hyz22KLz/?ref=app
4th Dec 2019, 1:00 PM
Janusz Bujak 🇵🇱 🇺🇦
Janusz Bujak 🇵🇱 🇺🇦 - avatar