[Python-ideas] Another way to avoid clumsy lambdas, while adding new functionality

Carl Smith carl.input at gmail.com
Wed Mar 5 13:41:10 CET 2014


Just for the record, I never called them bills just because they contain a
dollar sign! I was thinking of a short word which describes an expression
who's evaluation changes depending on the local circumstances. Like a legal
bill, not a dollar bill.

The name macro doesn't really work, as it's only an expression, it's not a
code block.

---

The idea was never to start passing complex expressions around the place.
It was just to allow a function to take an expression containing about one
or two names, and evaluate the expression internally, so this...

func(lambda foo: foo > 0)

...can become...

func($foo > 0)

Other uses are there, and might be helpful from time to time, but it's
mainly about cleaning up APIs. I personally work with user facing Python
APIs all day, and users are generally programming interactively, so perhaps
my take is atypical.

---

What the hell is a thunk anyway? It's a horrible name.

---

On the jQuery like syntax, $(foo), that might work and might do away with
the issue of expressions containing bills always evaluating to bills. I
took that too far. Good point.

Cheers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140305/5fa7acf1/attachment.html>


More information about the Python-ideas mailing list