J2 proposal: keyword

Paul Rubin http
Mon Aug 23 05:13:48 EDT 2004


Anthony Baxter <anthonybaxter at gmail.com> writes:
> using:
>     staticmethod 
>     accepts(int, str) 
>     returns(str) 
>     published(True)
> def bar(count, input):
>     return input * count

Semi-OT: since there's been all this noise about not wanting to
separate the decorators too much from the function name, etc., why are
"accepts" and "returns" decorators instead of having that stuff in
the function def itself?  E.g.:

   using:
      <whatever other decorators>
   def bar:str(count:int, input:str):
      return input * count

puts the info about the arg and return types where it belongs.  It
even looks a little bit Pascal-like.  I don't know if that last part
is good or bad ;-).



More information about the Python-list mailing list