getting name of passed reference

MRAB python at mrabarnett.plus.com
Tue Dec 29 14:01:35 EST 2009


Joel Davis wrote:
> On Dec 29, 11:21 am, Emile van Sebille <em... at fenx.com> wrote:
>> On 12/29/2009 7:02 AM Joel Davis said...
>>
>>> On Dec 29, 2:29 am, "Gabriel Genellina"<gagsl-... at yahoo.com.ar>
>>> wrote:
>>>> I'm sure other limitations apply too -- don't rely on this technique for
>>>> anything critical.
>>>> --
>>>> Gabriel Genellina
>>> Gabriel,
>>> thanks for your input, I had no idea that did that and it could have
>>> been deployed without even being aware of it, caused consternation and
>>> headaches galore.
>> In an extremely controlled situation you may avoid headaches when
>> deploying this kind of technique.  Regardless, we all want to make you
>> aware that this _will_ likely cause headaches, and, idle curiosity
>> aside, none of us can imagine the problem to which this is the
>> appropriate solution.
>>
>> It's fun to work out, but you're probably better served if you describe
>> the problem you're solving and consider the alternatives suggested.
>>
>> Dependence on introspection belongs in programming tools, not in
>> applications deployed across versions and platforms.
>>
>> Emile
> 
> Emile, essentially, the situation is that I'm trying to create an API
> for consumption scripting. As it stands now, in initial development
> they can pass callback function. The idea was to enable them to pass
> variables and have the handling function determine the type and just
> drop the value into it instead of calling function with the value as
> an argument. The problem with that approach is determining exactly
> which variable was passed. My idea was to use this to capture the name
> and then modify the globals for the executing frame so that the passed
> variable represents the new value.

All I can say is: Yuck! Don't do that! :-)



More information about the Python-list mailing list