[Python-Dev] Plea for function/method syntax sugar (PEP 318,
with a different syntax)
Bob Ippolito
bob at redivi.com
Thu Feb 19 13:46:30 EST 2004
On Feb 19, 2004, at 1:36 PM, Thomas Heller wrote:
> Bob Ippolito <bob at redivi.com> 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
More information about the Python-Dev
mailing list