Comments on Version 2, Draft Pep for Deprecating Builtins
Duncan Booth
duncan at NOSPAMrcp.co.uk
Tue Apr 30 04:20:04 EDT 2002
[posted and mailed]
grante at visi.com (Grant Edwards) wrote in
news:Bhgz8.58769$vm6.9975333 at ruti.visi.com:
> In article <Xns91FF9515A57Eduncanrcpcouk at 127.0.0.1>, Duncan Booth
> wrote:
>> holger krekel <pyth at devel.trillke.net> wrote in
>> news:mailman.1020082610.7467.python-list at python.org:
>>
>>> Btw, what is the best/shortest way to express 'filter' and 'reduce'
>>> with list comprehensions?
>>
> I find the "reduce" spelling simpler and easier to both read
> and write.
>
>> All of these replacements are big winners if they remove a use of the
>> 'l' word.
>
> If getting rid of "lambda" is the goal, then why not state that
> openly and propose elimination of "lambda".
No, getting rid of lambda is not a goal, getting rid of inappropriate use
of lambda might be. Most lambdas are best replaced by a named function or
by writing the code in a non-functional manner. Sometimes one is
appropriate, sometimes the other, sometimes the lambda is best. I do
believe that lambda is dangerous (because it is often overused), but I
don't think that it right to get rid of something just because it is
dangerous.
>> I don't think any of them lose in clarity even if there are no 'l's
>> around.
>
> You've got to be kidding -- especially looking at the "reduce"
> and "filter a string" examples.
The filter a string was a bit messy, but in real life I have never used
filter on a string. I wasn't kidding about the reduce though.
> If you want to move map/filter/reduce into a module, fine. I
> think it's too much breakage for too little gain, but whatever...
You could try addressing these comments to the people who made them.
I think there is plenty of scope for tidying up the builtins, but not until
Python 3 and I don't think that map/filter/reduce would be first on my
hitlist.
>
> However, claiming that they aren't useful because the above
> "replacements" are just as clear is just silly.
Who claimed that?
--
Duncan Booth duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
More information about the Python-list
mailing list