map/filter/reduce/lambda opinions and background unscientific mini-survey

Daniel Schüle uval at rz.uni-karlsruhe.de
Wed Jul 6 18:42:28 EDT 2005


I think in some contextes map is more readable than [f() for i in S]
because it's more verbatim
Removing lamdba would be reduce readability of Python, I think here
for examble of code like

class App:
	....
	....
	def drawLines(self, event):
		from random import randint
		r = lambda : randint(1, 100)
		self.canvas.create_line(r(), r(), r(), r())

defining one extra function would only confuse and
self.canvas.create_line(r(1, 100), r(1, 100), r(1, 100), r(1, 100))
is not very nice to look at

and what about creating one liner factories like
from math import log10
log = lambda basis: lambda x: log10(x) / log10(basis)
log2 = log(2)
log2(2**10) -> 10.0

I would consider it as a great loss for Python
if lambda will disappear




More information about the Python-list mailing list