James Stroud <[EMAIL PROTECTED]> writes:

> You should look into __cmp__ and other magic methods. This is probably
> the type of functionality you seem to be after.

Good example, I need to look at the magic methods.
What I want is to get the value of another variable in C. Would I need to
use __repr__ and get the id from it to find xx of the instance with
maximum x? 

class C:
   def __init__(self, x):
     self.x = x
     self.xx = x*x

sees = [C(x) for x in (4,7,1,3,0,9,2)]  # random-ish ints
print max(sees)

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

Reply via email to