new to python

Michael Hoffman m.h.3.9.1.without.dots.at.cam.ac.uk at example.com
Sun Oct 10 04:29:46 EDT 2004


Chris Patton wrote:

> I need to make several user-defined objects for a program I'm making.
> I know that one way is to use the exec statement (i.e. exec
> 'raw_input() = "cheese"'), but it can get very visually cluttered at
> times.
> i.e. exec raw_input()+num+'={"I":'+b+','+am+':"just","fine":1}'

Hi Chris. Your question has been discussed by several people already the 
last time you answered it. Please do us the courtesy of reading those 
answers before repeating your question.

Also, my short answer to your question is: don't do that! I really have 
to question why you need to set variables in local or global scope 
rather than just setting items in a dictionary. Why?
-- 
Michael Hoffman



More information about the Python-list mailing list