# HG changeset patch
# User Taylor Sutton <tsutton125@gmail.com>
# Date 1247263227 25200
# Node ID 415954b80bcbc6a492b64bbbcab25f15d1d6f52f
# Parent  bd75237b47e093391f6743fe032a9988c2d63cf6
Adds __nonzero__ to AbelianGroup.

diff -r bd75237b47e0 -r 67dc9082ecdc sage/groups/abelian_gps/abelian_group.py
--- a/sage/groups/abelian_gps/abelian_group.py	Mon Jun 22 22:52:22 2009 -0400
+++ b/sage/groups/abelian_gps/abelian_group.py	Sun Jul 12 01:13:13 2009 -0700
@@ -513,6 +513,19 @@
                 return False
         return True
 
+    def __nonzero__(self):
+        """
+        Returns True if this group is nontrivial.
+
+        EXAMPLES::
+
+            sage: E = EllipticCurve([0,82])
+            sage: T = E.torsion_subgroup()
+            sage: bool(T) # indirect doctest
+            False
+        """
+        return len(self.invariants()) != 0
+
     def dual_group(self):
         """
         Returns the dual group.
