Bind compiled code to name?

Karlo Lozovina _karlo_ at _mosor.net_
Sun Jun 22 20:43:49 CEST 2008


"Martin v. Löwis" <martin at v.loewis.de> wrote in
news:485e9aea$0$637$9b622d9e at news.freenet.de: 

> d = {}
> exec source_code in d
> some_name = d['some_name']

This works quite well! I can't believe after googling for half on hour I 
didn't notice this "exec ... in ..." syntax.
One more thing though, is there a way to access "some_name" as a 
attribute, instead as a dictionary:

some_name = d.some_name

?

Thanks...

-- 
 _______                                        Karlo Lozovina - Mosor
|   |   |.-----.-----.     web: http://www.mosor.net || ICQ#: 10667163
|       ||  _  |  _  |             Parce mihi domine quia Dalmata sum.
|__|_|__||_____|_____|



More information about the Python-list mailing list