Author: bugman Date: Thu May 3 22:01:53 2012 New Revision: 15929 URL: http://svn.gna.org/viewcvs/relax?rev=15929&view=rev Log: Added two iterator methods for looping over the user functions and classes. These are class_loop() and uf_loop(). Modified: branches/uf_redesign/user_functions/data.py Modified: branches/uf_redesign/user_functions/data.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/user_functions/data.py?rev=15929&r1=15928&r2=15929&view=diff ============================================================================== --- branches/uf_redesign/user_functions/data.py (original) +++ branches/uf_redesign/user_functions/data.py Thu May 3 22:01:53 2012 @@ -97,3 +97,27 @@ # Return the object. return self._uf[-1] + + + def class_loop(self): + """Iterator method for looping over the user function classes. + + @return: The class name and data container. + @rtype: tuple of str and Class_container instance + """ + + # Loop over the classes. + for i in range(len(self._class_names)): + yield self._class_names[i], self._classes[i] + + + def uf_loop(self): + """Iterator method for looping over the user functions. + + @return: The user function name and data container. + @rtype: tuple of str and Uf_container instance + """ + + # Loop over the user functions. + for i in range(len(self._uf_names)): + yield self._uf_names[i], self._uf[i]