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

Stephen Horne steve at ninereeds.fsnet.co.uk
Tue Mar 23 04:55:33 EST 2004


On Tue, 23 Mar 2004 08:39:19 GMT, Joe Mason <joe at notcharles.ca> wrote:

>Come to think of it, the verbose example with "has" becomes (assuming a
>shorter decorator name):
>
>    def foo(x has sig(int), y has sig(float)) has returns(int):

<snip>

>(No, I'm not seriously proposing decorators on parameters at this point.)

Damn - I thought it was a cool idea!

After all, in implementation terms it means little more than a few
extra statements at the top of the function - apart from being more
clearly associated with the call parameters in the definition, there
is nothing much new.

I'd just like to assert that more than one decorator may be needed,
perhaps in cases such as...

  def foo ( x [accepts(int), inrange(0,100)] ) [returns(int)] :

And assuming that these are mainly self-documentation and aids to
debugging and testing, it could be quite useful to get rid of most of
the overhead by perhaps having an option to ignore specified
decorators at compile time.


-- 
Steve Horne

steve at ninereeds dot fsnet dot co dot uk



More information about the Python-list mailing list