Origin of the term "first-class object"

Jp Calderone exarkun at intarweb.us
Mon Nov 24 13:58:10 EST 2003


On Mon, Nov 24, 2003 at 12:33:40PM -0500, Aahz wrote:
> In article <m8uub.235682$HS4.2034763 at attbi_s01>,
> Rainer Deyke <rainerd at eldwood.com> wrote:
> >Aahz wrote:
> >>Rainer:
> >>>
> >>> 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
> >>> redundancy:
> >>>
> >>> index = x * 2 + f(y)
> >>> l[index] = f(l[index])
> >>>
> >>> However, Python gives me no way to factor out the remaining
> >>> redundancy.
> >>
> >> Sure it does: change the immutable to a mutable.
> >
> >Not good enough.  
> 
> Why not?  Note that you're playing what is IMO an unfair game where you
> keep changing the goalposts.
> 
> >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.
> 
> Well, you're going to have to pay for what you want in some fashion;
> Python's going to keep its default semantics, so you're going to need
> *some* kind of wrapper.

  Up for a new operator?

    l[index] ()= f

  <1.5-wink>, Jp





More information about the Python-list mailing list