The problem with "as" [was "Re: PEP 318"]

Stephen Horne steve at
Tue Mar 23 10:20:34 CET 2004

On 22 Mar 2004 16:43:18 -0800, Paul Rubin
<> wrote:

>DH <no at> writes:
>> Possible future Python example that uses "as" differently:
>> def foo(x as int, y as float) as int:
>>     "this function returns an integer, and takes an int & float params"
>I think I'd rather use colons for that, like Pascal does, e.g.
>  def foo:int (x: int, y: float)
>hmm, the foo:int doesn't look too good.

In Ada, the type of a function return value is specified using an
explicit keyword ('returns' IIRC). I don't see the need for a unique
keyword just for that, but how about...

def foo (x: int, y: float) return int [decorators] :
def foo (x: int, y: float) yield  int [decorators] :

Steve Horne

steve at ninereeds dot fsnet dot co dot uk

More information about the Python-list mailing list