variable name and type confusion...

eugene kim eugene1977 at hotmail.com
Tue Nov 26 01:37:56 EST 2002


after table_name = Graph(table),
graphs.append(table_name) appends string type not Graph type

if i do exec "table_name = Graph(table)"
graphs.append(table_name) appends Graph type..

is this expected behavior?
i'm using python 2.2.1

table_list = ['abc', 'def']
tables['abc'] = Table(a)
tables['def'] = Table(b)

graphs = []
def tests(Graph):
    for table_name in table_list:
        table = tables[table_name]
        table_name = Graph(table) <--------------here
        graphs.append(table_name)



More information about the Python-list mailing list