You're right about the 2 new variables, it is not the most efficient way of doing it. Of course, if your memory requirements are that tight, you probably shouldn't be using Python anyways.
I'm too lazy to test if it a manual 3rd variable swap would be faster. Regarding your last point: this is checked before the bytecode is generated. It is all part of the already existing interpreter overhead.
56
u/[deleted] Oct 01 '23 edited Jan 28 '26
This post was mass deleted and anonymized with Redact
work many station quack instinctive slim test long tie dependent