On 25/06/2013 6:12 AM, Ian Kelly wrote:
On Mon, Jun 24, 2013 at 1:52 PM,  <jim...@aol.com> wrote:
Syntax:
fwhile X in ListY and conditionZ:

fwhile would act much like 'for', but would stop if the condition after the
'and' is no longer True.

I would advocate using the break myself.  Another alternative is this:

for X in itertools.takewhile(lambda X: conditionZ, ListY):
     ...

I'd probably just go with a generator expression to feed the for loop:

    for X in (i for i in ListY if conditionZ):
        ....

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to