Ignore:
Timestamp:
04/27/19 12:06:32 (5 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/xplane.py

    r919 r921  
    1212import codecs
    1313import math
     14from functools import total_ordering
    1415
    1516from xplra import XPlane, MultiGetter, MultiSetter, ProtocolException
     
    148149        return True
    149150
     151@total_ordering
    150152class PeriodicRequest(object):
    151153    """A periodic request."""
     
    198200        pass
    199201
    200     def __cmp__(self, other):
    201         """Compare two periodic requests. They are ordered by their next
    202         firing times."""
    203         return cmp(self._nextFire, other._nextFire)
     202    def __eq__(self, other):
     203        """Equality comparison by the firing times"""
     204        return self._nextFire == other._nextFire
     205
     206    def __ne__(self, other):
     207        """Non-equality comparison by the firing times"""
     208        return self._nextFire != other._nextFire
     209
     210    def __lt__(self, other):
     211        """Less-than comparison by the firing times"""
     212        return self._nextFire < other._nextFire
    204213
    205214class PeriodicDataRequest(PeriodicRequest):
Note: See TracChangeset for help on using the changeset viewer.