Stephan Diehl wrote: > replace '@collect_methods' with '@decorated.collect_methods' > and this will do what you want.
That is unlikely as it will keep a single list of methods for all classes derived from decorated: calling decorated.collect_methods will pass decorated as the cls parameter. What the OP wants it a separate list for each subclass. The way to do that of course is as others have suggested, just stick an attribute on each decorated function and then collect_methods goes through the class dict when it is called and picks out the correct methods. It could even build a list cached on the class at that time if it needs to (although the speedup is unlikely to be significant over just iterating through all the methods picking out the marked ones). -- http://mail.python.org/mailman/listinfo/python-list