A critic of Guido's blog on Python's lambda

Antoon Pardon apardon at forel.vub.ac.be
Tue May 9 10:15:19 CEST 2006


Op 2006-05-09, Pisin Bootvong schreef <joesb.coe9 at gmail.com>:
>
> Joe Marshall wrote:
>> Alex Martelli wrote:
>> Most languages allow `unnamed numbers'.  The `VAT_MULTIPLIER' argument
>> is a
>> strawman.  Would you want to have to use a special syntax to name the
>> increment
>> in loop?
>>
>>  defnumber zero 0
>>  defnumber one { successor (zero); }
>>
>>  for (int i = zero; i < limit; i += one) { ...}
>>
>> If you language allows unnamed integers, unnamed strings, unnamed
>> characters, unnamed arrays or aggregates, unnamed floats, unnamed
>> expressions, unnamed statements, unnamed argument lists, etc.  why
>> *require* a name for trivial functions?
>> Wouldn't all the other constructs benefit by having a required name as
>> well?
>>
>
> Is this a Slippery Slope fallacious argument?
> (http://c2.com/cgi/wiki?SlipperySlope)

No it is not.

> "if python required you to name every function then soon it will
> require you to name every number, every string, every immediate result,
> etc. And we know that is bad. Therefore requiring you to name your
> function is bad!!!! So Python is bad!!!!"

I think this is a strawman. IMO requiring to name a function can
make things cumbersome.

I don't suppose anyone thinks the following is good practice.

one = 1.
lst.append(one)


Yet this practice is forced upon you in a number of cases when
you require functions to be named. Look at the following:

def incr_cnt_by_one(obj):
  obj.cnt += 1

treat_all(lst, incr_cnt_by_one)

So the question I have is: Why is requiring me to give this function
a name considered a good thing, when it leads to a situation that
is considered bad practice in case of a number.

-- 
Antoon Pardon



More information about the Python-list mailing list