[Tutor] introspection
Alex Kleider
akleider at sonic.net
Wed Apr 22 03:04:05 CEST 2015
On 2015-04-21 16:48, Cameron Simpson wrote:
> But it would not be schizophrenic to write a function that returned a
> name arbitrarily, by inspecting locals(). It depends whether you only
> need a name, or if you need "the" name.
In my use case there'd probably be only one name for the given object so
I believe you've given me my next exercise!
>
> Write yourself a "find_name_from_locals(local_map, value)" function
> that reports. That will (a) get you a partial answer and (b) cement in
> your mind what is possible and why. Easy and useful!
I'll get working on that!
>
> Cheers,
> Cameron Simpson <cs at zip.com.au>
>
> Technique will get you through times of no strength a lot better than
> strength will get you through times of no technique. - the
> Nealomatic
Wonderful quote by the way!
More information about the Tutor
mailing list