Lisp mentality vs. Python mentality
steve at REMOVE-THIS-cybersource.com.au
Mon Apr 27 01:23:47 CEST 2009
On Sun, 26 Apr 2009 05:07:25 -0700, bearophileHUGS wrote:
> Paul Rubin:
>> Arnaud Delobelle:
>> > Do you mean imap(comp, a, b)?
>> Oh yes, I forgot you can do that. Thanks.
> That works and is nice and readable:
> import operator
> from itertools import imap
> def equal_sequences(a, b, comp=operator.eq):
Sorry, this is worse than unreadable. It is *misleading*. It doesn't test
for equal sequences except as a special case. What it does is perform a
generic element-by-element comparison, not necessarily an equality test.
What was wrong with the name compare() used in previous posts in this
More information about the Python-list