looping list problem

Fredrik Lundh fredrik at pythonware.com
Tue Aug 16 08:43:50 EDT 2005


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> 






More information about the Python-list mailing list