def __getitem__(self, key):
        """
        Return bin in selected position. (excluding empty bins)
        """
        if not isinstance(key, int):
            raise TypeError("Indices must be integers")

        size = len(self)  # avoid recalulations

        if key < 0:
            key += size

        if not 0 <= key < size:
            raise IndexError("Index out of range")
        
        if key < len(self._closed_bins):
            return self._closed_bins[key]
        else:
            return self._open_bins[key-len(self._closed_bins)]
def __getitem__ ( self , key ) : if not isinstance ( key , int ) : raise TypeError ( "Indices must be integers" ) size = len ( self ) if key < 0 : key += size if not 0 <= key < size : raise IndexError ( "Index out of range" ) if key < len ( self . _closed_bins ) : return self . _closed_bins [ key ] else : return self . _open_bins [ key - len ( self . _closed_bins ) ]
Return bin in selected position. (excluding empty bins)