Steven Bethard wrote:
Nick Coghlan: def-from syntax [4]
(def f(a) + o(b) - o(c) from (a, b, c))
(def x * x from (x))
(def x from ())
(def x.bar(*a, **k) from (*a, **k))
((def x(*a, **k) from ()) for x, a, k in funcs_and_args_list)

After a bit more musing, this is definitely my preferred syntax. I'd call it a 'deferred expression' rather than an anonymous function, though. The name change may seem minor, but it changes the emphasis of the feature from how it's implemented to what it is useful for (i.e. deferring evaluation of an expression until call time).


It's also conducive to a clean no-argument syntax - simply make the 'from' claus optional when the argument list is empty.

'def' and 'from' are already keywords, so there shouldn't be any compatibility problems.

Michael Spencer's idea of using 'for' instead of 'from' was quite interesting, but the use of 'for' without a corresponding 'in' feels a bit misleading :)

Cheers,
Nick.

--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
            http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to