ok :-) , ale s lambda sa mi to pacilo viac.
Pavel Kosina <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 10.11.2006 15:22 Please respond to Konference PyCZ <[email protected]> To Konference PyCZ <[email protected]> cc Subject Re: [python] Buducnost Pythonu: lambda, map, filter Roman Miklos napsal(a): > ok tak callmeback... > A ako urobim bez lambda nejaku funkciu, ktora mi vrati funkciu? > Napriklad toto: > > > f1(0)=0, f2(0)=0 > f1(1)=1, f2(1)=5 > f1(2)=2, f2(2)=10 > f1(3)=3, f2(3)=15 > f1(4)=4, f2(4)=20 > class linear(): def __init__(self,c): self.c=c def __call__(self,x): return self.c * x f1=linear(1) f2=linear(5) for x in range(5): print "f1(%d)=%d, f2(%d)=%d" % (x,f1(x),x,f2(x)) ;-) -- geon Pavel Kosina _______________________________________________ Python mailing list [email protected] http://www.py.cz/mailman/listinfo/python Mgr. Ing. Roman MIKLÓŠ Prvá stavebná sporiteľňa a.s. Bajkalská 30, P. O. Box 48 829 48 Bratislava 25 Tel.: +421/ 2 / 582 31 174 Fax: +421/ 2 / 582 31 109 _______________________________________________ Python mailing list [email protected] http://www.py.cz/mailman/listinfo/python
