bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnulib-tool.py: Coding style: Avoid bool()


From: Bruno Haible
Subject: gnulib-tool.py: Coding style: Avoid bool()
Date: Sat, 16 Mar 2024 14:22:08 +0100

I don't see the point of writing bool() where 99.9% of the Python developers
write False.
  = bool()    seen 62 times [1]
  = False     seen 358336 times [2]

[1] 
https://codesearch.debian.net/search?q=+%3D+bool%28%29+filetype%3Apython&literal=1
[2] 
https://codesearch.debian.net/search?q=+%3D+False+filetype%3Apython&literal=0


2024-03-16  Bruno Haible  <bruno@clisp.org>

        gnulib-tool.py: Coding style: Avoid bool().
        * pygnulib/GLModuleSystem.py (GLModule): Write False instead of bool().

diff --git a/pygnulib/GLModuleSystem.py b/pygnulib/GLModuleSystem.py
index ce2a60636c..9ad4715d8b 100644
--- a/pygnulib/GLModuleSystem.py
+++ b/pygnulib/GLModuleSystem.py
@@ -228,7 +228,7 @@ class GLModule(object):
 
     def __eq__(self, module):
         '''x.__eq__(y) <==> x==y'''
-        result = bool()
+        result = False
         if type(module) is GLModule:
             if self.path == module.path:
                 result = True
@@ -236,7 +236,7 @@ class GLModule(object):
 
     def __ne__(self, module):
         '''x.__ne__(y) <==> x!=y'''
-        result = bool()
+        result = False
         if type(module) is GLModule:
             if self.path != module.path:
                 result = True
@@ -244,7 +244,7 @@ class GLModule(object):
 
     def __ge__(self, module):
         '''x.__ge__(y) <==> x>=y'''
-        result = bool()
+        result = False
         if type(module) is GLModule:
             if self.path >= module.path:
                 result = True
@@ -252,7 +252,7 @@ class GLModule(object):
 
     def __gt__(self, module):
         '''x.__gt__(y) <==> x>y'''
-        result = bool()
+        result = False
         if type(module) is GLModule:
             if self.path > module.path:
                 result = True
@@ -265,7 +265,7 @@ class GLModule(object):
 
     def __le__(self, module):
         '''x.__le__(y) <==> x<=y'''
-        result = bool()
+        result = False
         if type(module) is GLModule:
             if self.path <= module.path:
                 result = True
@@ -273,7 +273,7 @@ class GLModule(object):
 
     def __lt__(self, module):
         '''x.__lt__(y) <==> x<y'''
-        result = bool()
+        result = False
         if type(module) is GLModule:
             if self.path < module.path:
                 result = True






reply via email to

[Prev in Thread] Current Thread [Next in Thread]