lambda question

David Eppstein eppstein at ics.uci.edu
Mon Mar 11 12:12:44 EST 2002


In article <mailman.1015866267.21439.python-list at python.org>,
 "Alves, Carlos Alberto - Coelce" <calves at coelce.com.br> wrote:

> first code:
> 
> 	f='x**3+2*x'
> 	list=[0,1,2,0]
> 	map(lambda x:eval(f),list)
> 
> second code:
> 
> 	def exe1(f,list):
> 		return map(lambda x:eval(f),list)
> 
> Can someone explain to me why the first code works while second doesn't.

You defined exe1 but forgot to call it?

-- 
David Eppstein       UC Irvine Dept. of Information & Computer Science
eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/



More information about the Python-list mailing list