chop() and empty() functions

Terry Reedy tjreedy at udel.edu
Fri May 26 14:43:48 EDT 2006


"Jeremy L. Moles" <jeremy at emperorlinux.com> wrote in message 
news:1148662460.2149.20.camel at localhost.localdomain...
> Furthermore, what do people think about the idea of adding a truly
> empty, no-op global lambda somewhere in Python?

In an important sense, there is no such object as a 'lambda' in Python. 
There are only function objects created with lambda expressions, which are 
pretty much  abbreviations of simple def statements.

> I use them a lot

For what?

> (usually defining a: empty = lambda *a, **k: None somewhere at the
> topmost module space),

Better to write 'def empty(*a,**k): pass' since this requires fewer 
keystrokes, attached the specific name 'empty' to the function object 
instead of the generic pseudoname '<lambda>', and does not feed the 
misunderstanding of lambda expressions.

> but if enough people did too, it might be worth
> adding an empty() builtin to much later versions of Python.

This seems to be a rare need, at least as expressed on clp.

Terry Jan Reedy






More information about the Python-list mailing list