https://bugzilla.wikimedia.org/show_bug.cgi?id=68705

--- Comment #6 from John Mark Vandenberg <[email protected]> ---
(In reply to Fabian from comment #5)
> The for-else does not differ between an empty list
> and a non empty.

This will work

for i, page in enumerate(generator, 1):
    ....
else:
    if 'i' not in locals():
        ...

(I dont like locals() being used)

There are many other ways to do it, including wrapping the generator in a
generator class that allows peaking.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to