Re: looping list problem

2005-08-17 Thread bruno modulix
Fredrik Lundh wrote: > Jon Bowlas wrote: (snip) >>But I get the following error- Line 5: Yield statements are not allowed. > > > umm. I might be missing something, but I cannot find any trace of that > error message in the Python interpreter source code. it doesn't even look > like a Python tr

RE: looping list problem

2005-08-16 Thread Jon Bowlas
Many thanks for your help, worked a treat Jon -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Otten Sent: 16 August 2005 17:25 To: python-list@python.org Subject: RE: looping list problem Jon Bowlas wrote: > Incidentally I'm doing this

RE: looping list problem

2005-08-16 Thread Peter Otten
Jon Bowlas wrote: > Incidentally I'm doing this in zope. Many posters (including me) in this newsgroup don't do zope, so your best option is to ask on a zope-related mailing list. > I was hoping that this would loop through the elements in the list > returned by the hiddens function comparing th

RE: looping list problem

2005-08-16 Thread Jon Bowlas
uld ignore it and move onto the next one, but it doesn't seem to do anything. Any help would be appreciated. Incidentally I'm doing this in zope. Jon -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Otten Sent: 16 August 2005 14:41 To

RE: looping list problem

2005-08-16 Thread Peter Otten
Jon Bowlas wrote: > 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 followi

Re: looping list problem

2005-08-16 Thread Peter Hansen
Jon Bowlas wrote: > 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 followi

Re: looping list problem

2005-08-16 Thread Fredrik Lundh
Jon Bowlas wrote: > 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

Re: looping list problem

2005-08-16 Thread Paul McGuire
Well, you are returning prematurely from a for loop, so that is why you are only getting the first value. Its just like: for i in range(100): return i It doesn't matter how big the range is you are iterating over, you'll return on the first element and that's it. If what you want is the

RE: looping list problem

2005-08-16 Thread Jon Bowlas
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_

Re: looping list problem

2005-08-16 Thread Fredrik Lundh
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 ins

looping list problem

2005-08-16 Thread Jon Bowlas
HI all, I'm fairly new to python and programming in general so I was hoping someone here may be able to help me. Let me explain what the problem I'm having is: I am trying to parse the XML of an attributes object I created, this object has the structure outlined below. Everything is ok on the par