Python assignment loop

Alexey Borzenkov snaury at gmail.com
Mon May 21 08:58:38 EDT 2007


On May 21, 8:12 am, "Silver Rock" <silverfrequ... at gmail.com> wrote:
> yes, that is the way I a solving the problem. using lists. so it seems
> that there is no way around it then..

There's at least one way to do it that I can think of straight away:

selfmodule = __import__(__name__, None, None, (None,))
setattr(selfmodule, "varname", value)

But I can't say it's anywhere near elegant.




More information about the Python-list mailing list