Here's an example from the STAX User's Guide (http://staf.sourceforge.net/current/STAX/staxug.html#Header_Script_Element):
Goal: Create a Python class object, Server, and generate three instance objects from the class and create a list of these Server objects. Then iterate through the server list, logging information about each server object in the server list. <script> # Define Server class class Server: def __init__(self, hostname, dir): self.hostname = hostname self.dir = dir def __repr__(self): return "<Server: hostname=%s, directory=%s>" % (self.hostname, self.dir) def getHostname(self): return self.hostname def getDir(self): return self.dir # Create an array of 3 Server objects serverList = [ Server('myServer.austin.ibm.com', 'C:/install'), Server('serverA.portland.ibm.com', 'D:/install'), Server('linuxServer.austin.ibm.com', '/usr/local/install') ] </script> <iterate var="server" in="serverList" indexvar="i"> <log> 'Server #%s: hostname=%s, directory=%s' % (i+1, server.getHostname(), server.getDir()) </log> </iterate> Thanks, David David Bender 11501 Burnet Rd. Phone (T/L): 1-512-286-5315 STAF/STAX Development Bldg. 903-5B002 (363-5315) Austin, TX ITN: 23635315 IBM Software Group, 78758-3400 Email: bda...@us.ibm.com WPLC From: Cindy Zhu <c...@fekete.com> To: "staf-users@lists.sourceforge.net" <staf-users@lists.sourceforge.net> Date: 03/08/2011 03:56 PM Subject: [staf-users] Calling Python functions Hi, Can you give me an example how to pass arguments to a Python function and call Python functions from a STAX job? Thanks, Cindy ------------------------------------------------------------------------------ What You Don't Know About Data Connectivity CAN Hurt You This paper provides an overview of data connectivity, details its effect on application quality, and explores various alternative solutions. http://p.sf.net/sfu/progress-d2d _______________________________________________ staf-users mailing list staf-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/staf-users
<<inline: graycol.gif>>
<<inline: ecblank.gif>>
------------------------------------------------------------------------------ What You Don't Know About Data Connectivity CAN Hurt You This paper provides an overview of data connectivity, details its effect on application quality, and explores various alternative solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________ staf-users mailing list staf-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/staf-users