Paulo da Silva wrote:
> In a class C, I may do setattr(C,'x',10).
> 
> Is it possible to use getattr/setattr for variables not inside
> classes or something equivalent? I mean with the same result as
> exec("x=10").

If you're at the module level, you can do::

     globals()['x'] = 10

If you're inside a function, you probably want to look for another way 
of doing what you're doing.

What's the actual task you're trying to accomplish here?

STeVe
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to