How can I use __setitem__ method of dict object?

jeremito jeremit0 at gmail.com
Wed Feb 7 10:07:42 EST 2007


On Feb 7, 8:28 am, "jeremito" <jerem... at gmail.com> wrote:
> On Feb 6, 5:10 pm, Bruno Desthuilliers
>
>
>
> <bdesth.quelquech... at free.quelquepart.fr> wrote:
> > jeremito a écrit :
> >  > On Feb 6, 2:36 pm, Bruno Desthuilliers > <bdesth.quelquech... at free.quelquepart.fr> wrote:
>
> > (snip)
>
> >  >>Here's an alternative implementation, so you get the idea.
>
> >  >>class Xs(dict):
>
> > oops ! I meant:
> >   class Xs(object):
>
> > of course...
>
> > (snip)
>
> > > I guess I just
> > > need more experience.
>
> > Possibly - but not only. You may want to have a look at the
> > FineManual(tm) for all this kind of "magic", starting with :http://docs.python.org/ref/specialnames.htmlhttp://docs.python.org/re...
>
> > HTH
>
> Thanks again!  Sometimes the problem is simply not knowing where to
> find the documentation, or finding the right portion of the
> documentation.  Your help has been invaluable.
>
> Jeremy

One more question.  I will be asking for the value of cs.xT *many*
(~millions) times.  Therefore I don't want it's value to be calculated
on the fly.  How can I set the value of xT whenever xS, xF, or xG are
changed, but not allow it to be set directly?  From the example given
previously, it seems like it can't be done this way.

Thans,
Jeremy




More information about the Python-list mailing list