[Python-ideas] Quick idea: defining variables from functions that take the variable name

Sven R. Kunze srkunze at mail.de
Fri Jun 3 08:30:23 EDT 2016


On 03.06.2016 00:10, Steven D'Aprano wrote:
> I am sorry, my post was not intended to be disrespectful. But I stand by
> it: if you wish to solve some other problem, then start a new thread.

The point was that solving "how to get the name" is only part of the 
bigger problem "how to get more context". So, putting things into 
perspective is important in order to avoid overfitting to a single use-case.

Maybe, my intention wasn't clear but it seems that I am not the only one 
seeing issues with a particular solution.


Sven

NOTE: sys._getframe(1) is not really a to-go solution. It tastes more 
like an internal API which normal devs shouldn't touch except for 
debugging purposes. Maybe, I am wrong here, but the _underscore supports 
that view.


More information about the Python-ideas mailing list