On 29/03/17 22:23, kay Cee wrote:
> func_list = ('func1', 'func2', 'func3')
>
> for f in func_list:
> eval(f)()
Instead of using strings just use the functions directly:
func_list = (func1, func2, func3)
for f in func_list:
f()
That avoids the potentially insecure eval and will be faster too.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor