On Thu, Aug 20, 2009 at 11:34 PM, Miles Kaufmann<mile...@umich.edu> wrote: > On Aug 20, 2009, at 11:07 PM, josef wrote: <snip> >> The following is what I would like to do: >> I have a list of class instances dk = [ a, b, c, d ], where a, b, c, d >> is an object reference. Entering dk gives me the object: [MyClass0 >> instance at 0x0000, MyClass1 instance at 0x0008, MyClass2 instance at >> 0x0010 ... ] >> >> I need the object reference name (a,b,c,d) from dk to use as input for >> a file. > > It sounds like you should either be storing that name as an attribute of the > object, or using a dictionary ({'a': a, 'b': b, ...}).
Shorter way to produce the same dictionary: dict(a=a, b=b, ...) Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list