[Python-Dev] Re: Re: Call for defense of @decorators (original) (raw)

Andrew McGregor andrew at indranet.co.nz
Wed Aug 11 00:19:20 CEST 2004


--On Tuesday, 10 August 2004 7:56 a.m. -0500 Skip Montanaro <skip at pobox.com> wrote:

I don't think anybody's come up with a candidate keyword that reads well in most/all situations. Consider:

make accepts(int, (int, float)) make returns(int) def foo(arg1, arg2): return arg1 * arg2

 make accepts(int, (int, float)):
     make returns(int):
         def foo(arg1, arg2):
             return arg1 * arg2

looks more like Python to me. And I know it's nested, but it reads better IMO.

Aren't we really trying to recreate def as a multi-line lambda that binds when it's in a context that is not expecting a function argument in block form? One way of looking at def or any of the other keywords that introduce blocks is as operators that take block(s) as argument(s).


Andrew McGregor Director, Scientific Advisor IndraNet Technologies Ltd http://www.indranet-technologies.com/

-----BEGIN GEEK CODE BLOCK----- Version: 3.1 GS/E/B/PA/SS d+(++) s+:+ a C++$ ULS++++ !P+++(---)$ L++++$ E++ W++ !N w(+++) !O() M++ V--() Y+$ PGP+ t- !5? X- !R !tv@ b++(++++) DI++ D+++@ G e+++ h(*)@ r% ------END GEEK CODE BLOCK------



More information about the Python-Dev mailing list