Origin of the term "first-class object"
rainerd at eldwood.com
Tue Nov 18 20:10:10 CET 2003
>> l[x * 2 + f(y)] = f(l[x * 2 + f(y)])
>> This statement contains an obvious redundancy that will make code
>> maintenance difficult. Python allows me to factor out some of the
>> index = x * 2 + f(y)
>> l[index] = f(l[index])
>> However, Python gives me no way to factor out the remaining
> Sure it does: change the immutable to a mutable.
Not good enough. I'd rather write "l[x] = f(l[x])" with all of its
redundancy than wrap every conceivable immutable object in a mutable
wrapper. Besides, I don't *want* 'f' to change an object (which may also be
referenced elsewhere); I want it to change a binding.
And, really, "l[x] = f(l[x])" isn't that big of a deal. It's a bit of
redundancy that I'd rather not have, but it's not bad enough that I feel the
need to do anything about it.
Rainer Deyke - rainerd at eldwood.com - http://eldwood.com
More information about the Python-list