@@ -1975,7 +1975,7 @@ def fully_equal(left, right, compare_color=True):
1975
1975
left.initial_probability == right.initial_probability)
1976
1976
1977
1977
1978
- def __nonzero__ (self):
1978
+ def __bool__ (self):
1979
1979
"""
1980
1980
Returns True.
1981
1981
@@ -1990,12 +1990,15 @@ def __nonzero__(self):
1990
1990
TESTS::
1991
1991
1992
1992
sage: from sage.combinat.finite_state_machine import FSMState
1993
- sage: FSMState('A').__nonzero__( )
1993
+ sage: bool( FSMState('A'))
1994
1994
True
1995
1995
"""
1996
1996
return True # A state cannot be zero (see __init__)
1997
1997
1998
1998
1999
+ __nonzero__ = __bool__
2000
+
2001
+
1999
2002
def _epsilon_successors_(self, fsm=None):
2000
2003
"""
2001
2004
Returns the dictionary with states reachable from ``self``
@@ -2502,7 +2505,7 @@ def __ne__(left, right):
2502
2505
return (not (left == right))
2503
2506
2504
2507
2505
- def __nonzero__ (self):
2508
+ def __bool__ (self):
2506
2509
"""
2507
2510
Returns True.
2508
2511
@@ -2517,11 +2520,13 @@ def __nonzero__(self):
2517
2520
EXAMPLES::
2518
2521
2519
2522
sage: from sage.combinat.finite_state_machine import FSMTransition
2520
- sage: FSMTransition('A', 'B', 0).__nonzero__( )
2523
+ sage: bool( FSMTransition('A', 'B', 0))
2521
2524
True
2522
2525
"""
2523
2526
return True # A transition cannot be zero (see __init__)
2524
2527
2528
+ __nonzero__ = __bool__
2529
+
2525
2530
2526
2531
#*****************************************************************************
2527
2532
@@ -3918,7 +3923,7 @@ def __call__(self, *args, **kwargs):
3918
3923
#*************************************************************************
3919
3924
3920
3925
3921
- def __nonzero__ (self):
3926
+ def __bool__ (self):
3922
3927
"""
3923
3928
Returns True if the finite state machine consists of at least
3924
3929
one state.
@@ -3933,12 +3938,15 @@ def __nonzero__(self):
3933
3938
3934
3939
TESTS::
3935
3940
3936
- sage: FiniteStateMachine().__nonzero__( )
3941
+ sage: bool( FiniteStateMachine())
3937
3942
False
3938
3943
"""
3939
3944
return len(self._states_) > 0
3940
3945
3941
3946
3947
+ __nonzero__ = __bool__
3948
+
3949
+
3942
3950
def __eq__(left, right):
3943
3951
"""
3944
3952
Returns ``True`` if the two finite state machines are equal,
0 commit comments