[Pyobjc-dev] Re: [Python-Dev] Plea for function/method syntax sugar (PEP 318, with a different synta
Brought to you by:
ronaldoussoren
From: Bob I. <bo...@re...> - 2004-02-19 18:49:00
|
On Feb 19, 2004, at 1:36 PM, Thomas Heller wrote: > Bob Ippolito <bo...@re...> writes: > >> Here's a quick overview: >> >> def foo(args) [sugary, expressions, list]: >> pass >> >> This is equivalent to: >> >> def foo(args): >> pass >> foo = list(expressions(sugary(foo))) [examples showing how much nicer it makes type annotation in ctypes and PyObjC] > BTW (I have this patch not yet applied), is it possible to use more > than > one line, in this way? > > def function(arg1, arg2, arg3, arg4, arg5, arg6) > [dothis, dothat, doanother]: > > All in all, I'm +1 on the patch. No, that is not valid syntax with the current patch.. you would need: def function(arg1, arg2, arg3, arg4, arg5, arg6 ) [dothis, dothat, doanother]: or def function(arg1, arg2, arg3, arg4, arg5, arg6) [ dothis, dothat, doanother]: (or some variation, that makes it obvious to Python that the def is not complete). -bob |