r/Python • u/RickSore • Nov 14 '17
Senior Python Programmers, what tricks do you want to impart to us young guns?
Like basic looping, performance improvement, etc.
1.3k
Upvotes
r/Python • u/RickSore • Nov 14 '17
Like basic looping, performance improvement, etc.
5
u/peedubyaeff Nov 14 '17 edited Nov 14 '17
Turns out the locals are stored in 'cells', and referenced in the bytecode: https://docs.python.org/2/c-api/cell.html
I don't see how you'd tie the cell back to the variable name though, so if you have more than one and need to know which is which you might be out of luck.
Edit - Of course, if you're actually using a debugger it will know the variable name from the frame you're in: