On Sep 12, 12:28 pm, j.m.dagenh...@gmail.com wrote: > def setname(cls): > '''this is the proposed generator to call SetName on the object''' > try: > cls.SetName(cls.__name__) > finally: > yield cls
A generator is (basically) a callable that acts like an iterator. You'd use a generator if you wanted to loop with for or a list comprehension across the output of the generator: for foo in setname(Test) A decorator is a callable that takes another callable as an argument, either modifying it or returning a wrapped version of it: Test = setname(Test) You don't want to iterate over anything, so you should change `yield` to `return`. -- http://mail.python.org/mailman/listinfo/python-list