https://bugzilla.wikimedia.org/show_bug.cgi?id=68705
--- Comment #4 from John Mark Vandenberg <jayvdb(a)gmail.com> ---
(In reply to xqt from comment #3)
cat.articles() is a generator and bool(cat.articles())
is always True.
You may try a simple performace test like:
>> import pwb, pywikibot as py
>> s = py.Site()
>> c = py.Category(s, 'Mann')
>> c.categoryinfo['pages']
456626
You'll get the result above immediately
I see the server doesnt spend much time working on this, as it loads the data
from the category table.
https://www.mediawiki.org/wiki/Manual:Category_table
However it is another API call on the server, which adds more network latency
(think someone in the jungle of Borneo on a 3G modem), server workload and
delays (an issue on slower wikis), etc.
>> g = c.articles()
len(set(g))
You may wait several minutes to get a result. I've given up after 5.
len(set(g)) is obviously not the best way to determine if the generator has any
results.
The best way is, I think, to process the generator with an else block to detect
if the generator had no results. There are other tricks to instantaneously
determine if the generator is empty.
--
You are receiving this mail because:
You are the assignee for the bug.