Extending Python Syntax with @

Tony Meyer t-meyer at ihug.co.nz
Wed Mar 10 19:42:24 EST 2004


> The difference is that @ not a 
> menagerie of symbols with various tricky meanings, but one 
> very noticable and unique symbol that says "Pay attention, I 
> am different."  It has no other meaning.

Well, I think if you asked most people, they'd say that the typical meaning
of @ is 'at'.  So it might make sense for something like "characters @
centre(string)" or something, but I'm not sure that many people would think
it meant "pay attention".

> Wouldn't it be nice, for example, if instead of special 
> keywords like 'lambda' and 'yield', we had used '@(args)' and 
> '@return'.  ( No, I'm not advocating we go back and change 
> what has been done.)  In both these cases, we had a 
> well-established syntax that needed a slight variation.  

The thing about "lambda" and "yield" is that they are easily understandable.
People see "yield", not knowing what the code does, and think "give" - and
that is what it's going - giving a value.  If they see "@return", what do
they think?  Lambda is less well understood, but well used in other places.

My 2c.

=Tony Meyer





More information about the Python-list mailing list