def symbol_gen(sym_str):
 n = 0
 while True:
  (yield Symbol(('%s_%d' % (sym_str, n))))
  n += 1

def symbol_gen ( sym_str ) : n = 0 while True : ( yield Symbol ( ( '%s_%d' % ( sym_str , n ) ) ) ) n += 1
symbol generator generates sym_str_n where n is the number of times the generator has been called .