Skip to content
Snippets Groups Projects
Forked from Platform / Development / swh-core
Source project has a limited visibility.
  • vlorentz's avatar
    d230cb3d
    SortedList: Don't inherit from UserList. · d230cb3d
    vlorentz authored
    A class should only inherit from UserList if the type of data it presents is
    the same as the data in the 'data' attribute, which isn't true here.
    
    This means, for example, that SortedList.__contains__ checked if the value
    is in self.data, which always returns False (unless unlucky, but then it
    returns True while it shouldn't).
    
    By removing this inheritance, methods that are no longer implemented no longer
    default to a buggy implementation.
    d230cb3d
    History
    SortedList: Don't inherit from UserList.
    vlorentz authored
    A class should only inherit from UserList if the type of data it presents is
    the same as the data in the 'data' attribute, which isn't true here.
    
    This means, for example, that SortedList.__contains__ checked if the value
    is in self.data, which always returns False (unless unlucky, but then it
    returns True while it shouldn't).
    
    By removing this inheritance, methods that are no longer implemented no longer
    default to a buggy implementation.