[Python-Dev] Extended Function syntax

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


"Samuele Pedroni" <pedronis@bluewin.ch> writes:

> From: "Jack Jansen" <Jack.Jansen@oratrix.com>
>> Hmm, the __name__'s of various builtin types are not exposed in any
>> namespace, are they? Otherwise we could say that "def foo():" is really
>> a shorthand for "def xxx.function foo():", and maybe even "class Bar:"
>> for "def xxx.classobj Bar:"
>
> function have formal parameters which are not a tuple of values computed at
> definition time like superclasses for a class, so it seems that both shorthand
> cannot be made work at the same time.

This sentences took some time to parse, but you're right.

> reusing 'def' is a possibility for the KEYW-TO-BE in my post, but it's
> clear-cut that's the least confusing choice.

There's a "not" missing here, I think.

> Unless we go for a generalization of 'def' (function) instead of
> 'class' but it would make def property more odd because property
> would likely have to receive a code object instead of a populated
> dict.

There's something odd about writing

def property foo:
    ...

Both of

defprop foo:
    ...

or 

define property foo:
    ...

seem more natural.

def foo [property]:
    ...

anyone?  Probably relying on the difference between [ and ( kills it.

Cheers,
M.


-- 
  Just put the user directories on a 486 with deadrat7.1 and turn the
  Octane into the afforementioned beer fridge and keep it in your
  office. The lusers won't notice the difference, except that you're
  more cheery during office hours.              -- Pim van Riezen, asr