On Mar 14, 9:32 pm, "Drew" <[EMAIL PROTECTED]> wrote: > I'm using Python2.5 and it seems that this only gives me a hash with > the first id and first record. Am I doing something wrong?
Try this instead: >>> class Person(): ... def __init__(self): ... self.id = 5 ... >>> mylist = [] >>> for i in range(100): ... p = Person() ... p.id = i ... mylist.append(p) ... >>> mydict = dict((r.id,r) for r in mylist) >>> mydict What this does is it maps the id to the object. In your case, you only have one id. -Samuel -- http://mail.python.org/mailman/listinfo/python-list