Code Objects / Variable Names

Christos TZOTZIOY Georgiou tzot at sil-tec.gr
Thu Jan 8 12:12:51 EST 2004


On 7 Jan 2004 00:51:45 -0800, rumours say that drfransch at netscape.net
(F. Schaefer) might have written:

>For the following (compiled) condition 
>
>          (door == "ajar"   and   alternator == "off") || time > 25
>
>  I need to extract, that the variables 'door', 'alternator' and 'time'
>  are involved.

I believe that the solution that Francis and Andrew proposed is the most
suitable for your case.  There is another one, however, that *might* be
useful sometime: use the eval(your_code, globals, locals) form, and
catch the NameError exceptions.
-- 
TZOTZIOY, I speak England very best,
Ils sont fous ces Redmontains! --Harddix



More information about the Python-list mailing list