The problem with "as" [was "Re: PEP 318"]
Marco Bubke
marco at bubke.de
Tue Mar 23 09:56:39 EST 2004
Stephen Horne wrote:
> On 22 Mar 2004 16:43:18 -0800, Paul Rubin
> <http://phr.cx@NOSPAM.invalid> wrote:
>
>>DH <no at sp.am> 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] :
I like :
def foo(x=42:int, y=3.14:float) [return(string)]:
def foo[return(string)](x=42:int, y=3.14:float):
looks strange to me. Its very unreadable. Its maybe the first time I really
disagree with a Idea of Guido. :-)
More information about the Python-list
mailing list