Ignore:
Timestamp:
04/27/19 12:06:32 (5 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
Phase:
public
Message:

Fixed ordering for classes that used cmp (re #347).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/fsuipc.py

    r919 r921  
    1313import codecs
    1414import math
     15from functools import total_ordering
    1516
    1617if os.name == "nt" and "FORCE_PYUIPC_SIM" not in os.environ:
     
    197198                Handler._callSafe(lambda: self._callback(None, self._extra))
    198199
     200    @total_ordering
    199201    class PeriodicRequest(object):
    200202        """A periodic request."""
     
    250252            pass
    251253
    252         def __cmp__(self, other):
    253             """Compare two periodic requests. They are ordered by their next
    254             firing times."""
    255             return cmp(self._nextFire, other._nextFire)
     254        def __eq__(self, other):
     255            """Equality comparison by the firing times"""
     256            return self._nextFire == other._nextFire
     257
     258        def __ne__(self, other):
     259            """Non-equality comparison by the firing times"""
     260            return self._nextFire != other._nextFire
     261
     262        def __lt__(self, other):
     263            """Less-than comparison by the firing times"""
     264            return self._nextFire < other._nextFire
    256265
    257266    def __init__(self, connectionListener,
Note: See TracChangeset for help on using the changeset viewer.