Commits

Anonymous committed 04b4dfb

simplify length computation

Comments (0)

Files changed (1)

         for i, imp in enumerate(importance):
             catname = cat_importance % (prefix, imp)
             cat = pywikibot.Page(site, catname)
-            lenCat = 0
             for p in site.categorymembers(cat, namespaces=[1]):
                 artByCat[imp].add(p)
-                lenCat += 1
                 articles[p.title()][0] = imp
+            lenCat = len(artByCat[imp])
             results[project][43 + i] = u'[[:%s|{{formatnum:%s}}]]' % (catname, lenCat)
             total += lenCat