Batching HTTP requests with httplib (Python 2.7)

Xavier Combelle xavier.combelle at free.fr
Fri Sep 14 07:46:38 EDT 2012


instead of

Le 14/09/2012 12:56, Dwight Hutto a écrit :
> service_num_list = [num for num in range(0,5)]
> for service_num in service_num_list:
> 	eval("web_service_call%i(%i)" % (service_num,service_num))
>
>
service_num_list = [num for num in range(0,5)]
for service_num in service_num_list:
	locals()["web_service_call%i" % (service_num,)](service_num)

would be safer eval is really bad




More information about the Python-list mailing list