Dynamic list name from a string

MarcoS marc.sedda at gmail.com
Mon Dec 20 06:38:31 EST 2010


Ok, thanks Steven and Andre for yours reply.

This is my situation:
I've a list of objects of differents classes, with a common attribute
name
Something like this:

class Object1:
    obj1_name
    .... other fields
    date

class Object2:
    obj2_name
    .... other fields
    date

...

class ObjectN:
    objN_name
    .... other fields
    date

the lists are created dynamically at runtime, depending or not if
there one or more correspondig Objects,
ex.
list_object1 = [object1_1, object1_2 ... object1_n]
...
list_objectN = [object2_1, object2_2 ... object2_n]

Then i need to include all into one global list sorting the various
objects by date
ex
global_list = [object1_1, object2_n, object1_2 ... etc]

I think that Andre solution it's the best way to solve my dynamics
lists problem, now I'll
verify how to create the global list and sort it



More information about the Python-list mailing list