Simple questions on use of objects (probably faq)

Brian Elmegaard brian at rkspeed-rugby.dk
Thu Mar 9 07:23:22 EST 2006


Steven D'Aprano <steve at REMOVETHIScyber.com.au> writes:

> Can you explain more carefully what you are trying to do? If you want the
> square of the maximum value, just do this:

I want to get the value of another attribute of the instance with
maximum x. 

I know I could do it like you suggest for the case with x*x, but the
other attribute does not depend on x.

> [The above paragraph is always true, except for the exceptions when it is
> not true. You will know when you need id(). If you only *think* you need
> id(), you don't need it.]

:-)

> algorithm relies on object X knowing that it is the 5th item of list L,
> then you must either store that information yourself somewhere, and
> maintain it, or you must change your algorithm. 

OK, I think this is the answer I was looking for.

-- 
Brian (remove the sport for mail)
http://www.et.web.mek.dtu.dk/Staff/be/be.html
http://www.rugbyklubben-speed.dk



More information about the Python-list mailing list