help me

dataangel k04jg02 at kzoo.edu
Sat Oct 9 23:34:03 EDT 2004


Richard Blackwood wrote:

> <SNIP>
>
>>
>>
>> >>> globals()[raw_input("enter name: ")] = 34
>> enter name: raw_input
>> >>> globals()[raw_input("enter name: ")] = 34
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in ?
>> TypeError: 'int' object is not callable
>> >>>
>>
>>                 Andrew
>>                 dalke at dalkescientific.com
>
>
> exec and eval is dangerous stuff for the inexperienced.  Dictionary is 
> an excellent idea Andrew.  However, if what he wants to do is as 
> simple as the example he gave, he doesn't even need a dictionary.
>
>
Alright, you say he doesn't need a dictionary, and the other guy says he 
doesn't actually need eval. What is this mysterious non-exec, non-eval, 
non-globals(), non-dictionary solution? ;)




More information about the Python-list mailing list