Russell Blau has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/132593

Change subject: Code style improvement
......................................................................

Code style improvement

Using "if not total:", although technically correct, is confusing
when an integer is expected, and makes code maintenance more difficult.
Replace with "if total == 0:" which is easier to understand.

Change-Id: I5571600cf180bca7c700f2ada148dbd580b25250
---
M pywikibot/page.py
1 file changed, 8 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/93/132593/1

diff --git a/pywikibot/page.py b/pywikibot/page.py
index 43111d0..fe54ef6 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -1812,7 +1812,7 @@
                 yield subcat
                 if total is not None:
                     total -= 1
-                    if not total:
+                    if total == 0:
                         return
                 if recurse:
                     for item in subcat.subcategories(
@@ -1820,14 +1820,14 @@
                         yield item
                         if total is not None:
                             total -= 1
-                            if not total:
+                            if total == 0:
                                 return
         else:
             for subcat in self._subcats:
                 yield subcat
                 if total is not None:
                     total -= 1
-                    if not total:
+                    if total == 0:
                         return
                 if recurse:
                     for item in subcat.subcategories(
@@ -1835,7 +1835,7 @@
                         yield item
                         if total is not None:
                             total -= 1
-                            if not total:
+                            if total == 0:
                                 return
 
     @deprecate_arg("startFrom", "startsort")
@@ -1895,7 +1895,7 @@
             yield member
             if total is not None:
                 total -= 1
-                if not total:
+                if total == 0:
                     return
         if recurse:
             if not isinstance(recurse, bool) and recurse:
@@ -1913,7 +1913,7 @@
                     yield article
                     if total is not None:
                         total -= 1
-                        if not total:
+                        if total == 0:
                             return
 
     def members(self, recurse=False, namespaces=None, step=None, total=None,
@@ -1925,7 +1925,7 @@
             yield member
             if total is not None:
                 total -= 1
-                if not total:
+                if total == 0:
                     return
         if recurse:
             if not isinstance(recurse, bool) and recurse:
@@ -1937,7 +1937,7 @@
                     yield article
                     if total is not None:
                         total -= 1
-                        if not total:
+                        if total == 0:
                             return
 
     def isEmptyCategory(self):

-- 
To view, visit https://gerrit.wikimedia.org/r/132593
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5571600cf180bca7c700f2ada148dbd580b25250
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Russell Blau <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to