On 2015-01-24 17:21, Steven D'Aprano wrote:
> # Cobra
> def sqroot(i as int) as float
> 
> # Python
> def sqroot(i:int)->float:
> 
> 
> Cobra's use of "as" clashes with Python. In Python, "as" is used for
> name-binding:
> 
> import module as name
> with open('file') as f
> except Exception as e
> 
> but apart from that minor difference, they're virtually identical.

Though given that

 def sqrt(i as int) as float:

is invalid Python syntax (both in the parameter list and as the
return value of the function), the meaning of "as" could be overloaded
in both senses to allow for the Cobra-like syntax.

-tkc


-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to