[Python-Dev] Extended Function syntax

Samuele Pedroni pedronis@bluewin.ch
Thu, 30 Jan 2003 17:43:24 +0100


From: "Moore, Paul" <Paul.Moore@atosorigin.com>
>From: Samuele Pedroni [mailto:pedronis@bluewin.ch]
>> the first candidate would be a generalization of 'class'
>> (although that make it redundant with 'class' and meta-classes)
>> so that
>>
>> KEYW-TO-BE  kind  name [ '(' expr,... ')' ]  [ maybe [] extended syntax ]:
>>    suite
>>
>> would be equivalent to
>>
>> name = kind(name-as-string,(expr,...),dict-populated-executing-suite)
>
>[fixed up to exclude the docstring, as per the followup message]

an alternative (if parseable, I have not fully thought about that) would be to
leave out the KEYW-TO-BE and try to parse directly

kind  name [ '(' expr,... ')' ]  [ maybe [] extended syntax ]:

where kind could be any general expr or better only a qualified name  that are
NOT keywords, so we would possible have:

property foo:
 <suite>

interface.interface I(J,K):
  <suite>

all working  as specified like 'class' and with its scope rules.

Control flow statements would still have to be added to the language one by one
(I find that ok and pythonic). Also because specifying and implementing
implicit thunk with proper scoping and non-local return etc does not (to me)
seem worth the complication.

About extending or generalizing function 'def' beyond [] extended syntax, I
don't see a compelling case.