The problem with "as" [was "Re: PEP 318"]
Skip Montanaro
skip at pobox.com
Mon Mar 22 22:08:27 EST 2004
DH> Possible future Python example that uses "as" differently:
DH> def foo(x as int, y as float) as int:
DH> "this function returns an integer, and takes an int & float params"
With no extension beyond the current PEP 318 proposal, you might postulate
returns() and accepts() decorators:
def foo(x, y) [accepts(int, float), returns(int)]:
...
which extend foo() with code to enforce input and output types. Further,
function attributes could be added which could be used by tools like
pychecker for intermodule type checking.
Skip
More information about the Python-list
mailing list