Ok so I changed it to this: attobject = context.get_attobject() navstring = context.get_uclattribute(attobject, 'ucl_navhide') hiddennavelements = navstring.split(' ') for hiddennavelement in hiddennavelements: yield hiddennavelements
But I get the following error- Line 5: Yield statements are not allowed. Any ideas -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fredrik Lundh Sent: 16 August 2005 13:44 To: python-list@python.org Subject: Re: looping list problem Jon Bowlas wrote: > attobject = context.get_attobject() > navstring = context.get_uclattribute(attobject, 'ucl_navhide') > hiddennavelements = navstring.split(' ') > for hiddennavelement in hiddennavelements: > return hiddennavelement > > So the script 'get_attobject' basically looks for an instance of the > attributes object in the current folder, if it doesn't locate one then it > uses acquisition to find one in a parent folder. The script > 'get_uclattribute' then gets the nodeValues of the requested node. In this > instance its ucl_navhide, then I split the 'navstring' string at the spaces > and attempt the for-loop to output each of the values. > > Unfortunately it appears I am unable to loop through each of the list items > in hiddennavelements, as it only returns the first value & will not repeat. did you perhaps mean to use "yield" instead of "return" ? </F> -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list