A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-February/042795.html below:

[Python-Dev] other uses for "as" [was Re: new syntax for wrapping (PEP 318)]

[Python-Dev] other uses for "as" [was Re: new syntax for wrapping (PEP 318)]Doug Holton d.holton at vanderbilt.edu
Thu Feb 26 17:02:23 EST 2004
> would also be sensible syntax.  But, the real monkeywrench here is that:
> 
>     def func1(x as int, y as float) as staticmethod:
> 
> now looks like it *returns* a staticmethod, which is wrong.
 >
> So, thanks to your argument, I'm now leaning a little more towards using 
> [] rather than "as", because "as" looks like syntax that should be 
> reserved for adaptation at a future time.  :)

You're right.  I had forgotten that Visual Basic uses "as" to specify 
the return type of a function too.

I guess [] (or any list object) is better for method decorators.

Maybe in the future you could have something like:

def myfunc(x as int, y as float) [synchronized, staticmethod] as int:
    ...

So "as" is always and only associated with adaptation.

x = myfunc(1, 2.0)
  --> means x = adapt(myfunc(adapt(1,int),adapt(2.0,float)), int)

p = q as int
  --> means p = adapt(q, int)


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4