[Python-Dev] Extended Function syntax

Michael Hudson mwh@python.net
Thu, 30 Jan 2003 10:51:27 +0000


"Moore, Paul" <Paul.Moore@atosorigin.com> writes:

>> the remaining problem would be to pick a suitable KEYW-TO-BE
>
> "block"?
>
> Someone, I believe, suggested reusing "def" - this might be nice, but IIRC
> it won't work because of the grammar's strict lookahead limits. (If it does
> work, then "def" looks good to me).

I think you can left factor it so it works

func :: func_start func_middle ':'
func_start :: "def" NAME
func_middle :: '(' arglist ')'
func_middle :: NAME '(' testlist ')'

> If def won't work, how about "define"? The construct is sort of an extended
> form of def. Or is that too cute?

It's a new keyword.

> By the way, can I just say that I am +1 on Michael Hudson's original patch
> for [...] on definitions. Even though it doesn't solve the issue of
> properties, I think it's a nice solution for classmethod and staticmethod,
> and again I like the generality.

Yes, I do think this patch is in danger of being forgotten... 

Cheers,
M.

-- 
  The Oxford Bottled Beer Database heartily disapproves of the 
  excessive consumption of alcohol.  No, really.
                        -- http://www.bottledbeer.co.uk/beergames.html