>>>>> "David" == David MacQuigg <dmq at gain.com> writes:
David> Wouldn't it be nice, for example, if instead of special keywords
David> like 'lambda' and 'yield', we had used '@(args)' and '...@return'.
David> ( No, I'm not advocating we go back and change what has been
David> done.) In both these cases, we had a well-established syntax
David> that needed a slight variation.
I don't think it is an improvement. If you get puzzled reading a program
with lambda expressions, you remember that you conveniently skipped reading
"lambda" in the docs. If you read a program with generator, you know the
"yield" section at the new Python docs will help. Both is very clear
mentally: you can easily recall what you've learnt. If you read a program
containing silly @, where should you look? And will you still remember it
after 2 years of programming solely in Perl? I think everybody trying to
add language construct should remember "explicit is better than implicit".
David> The 'lambda function' for example, was needed to cram a small
David> block of code into a tight space. By saying '@x,y:' instead of
David> 'lambda x,y:', we not only avoid the need for a new keyword, but
David> we better serve the purpose of tightly packing some code. We
David> would also avoid mystifying beginners. "It has no magic meaning.
David> It's just a way to write a function without a name."
There is no real need to "cram a small block of code into a tight space":
your space is unlimited when writing programs. There are times when you
should want using less space: when you are expressing a sequence of really
simple things. If you are writing something as complicated as a "lambda x,
y: ..." and that "..." can't be put into your program conveniently, the odds
are that it really takes effort to understand that part. Then I don't think
that one really should try to put it into less space.