Operators for everything (was Re: Operators for matrix)

Paul Prescod paul at prescod.net
Mon Jul 24 17:23:54 EDT 2000


Tim Rowe wrote:
> 
> In article <m3em4ld5t3.fsf at atrus.jesus.cam.ac.uk>, mwh21 at cam.ac.uk
> (Michael Hudson) wrote:
> 
> > Sorry, but eh?  I fail to understand you, I think.
> >
> > Example usage of what I'm talking about:
> >
> > def add(x,y):
> >     return x + y
> >
> > 1 @add 1
> >   ==> 2
> 
> My problem is that identifiers that refer to overloaded infix operators
> must begin with a @ (and presumably any identifier beginning with @ must
> be an overloaded infix operator). 

That's simply not true. The name of the function is "add". At the
syntactic level, "@" is an operator that takes three arguments, a left
operand, a right operand and an operation to apply. It is a
meta-operator.

@add is not an identifier. *add* is the identifier.

Personally, I think that this proposal is far more palatable then the
others which add five or more inscrutable multi-character symbols to the
Python lexicon. This one adds one character -- the meta-operator.

-- 
 Paul Prescod - Not encumbered by corporate consensus
New from Computer Associates: "Software that can 'think', sold by 
marketers who choose not to."




More information about the Python-list mailing list