ilejn <ilja.golsht...@gmail.com> writes: > Hello! > > I have a sequence of a function calls. Basically it looks like > > f(arg1) > f(arg2) > ... > f(argN) > > though real arguments are complex multilayer lists. > > The problem is some arguments are not known and I get NameError > exceptions. > > The solutions I know > 1. wrap every f call in try/except block > 2. make (currently global) argument attributes of a class and use > __getattr__ to convert unknown attributes to something recognizable by > f.
for name in 'arg1', 'arg2', ... 'argN': try: arg = globals()[name] except NameError: continue f(arg) But this is a strange problem... Sounds like you should do it differently. -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list