(self, num, create=False)
return 0
Returns the bin index corresponding to the given number.

        @param num: the number for which the bin is being sought
        @param create: whether to create a new bin if no bin exists yet.
        @return: the index of the bin or C{None} if no bin exists yet and
          {create} is C{False}.
Returns the bin index corresponding to the given number.
Returns the bin index corresponding to the given number .
def _get_bin(self, num, create=False):
        """Returns the bin index corresponding to the given number.

        @param num: the number for which the bin is being sought
        @param create: whether to create a new bin if no bin exists yet.
        @return: the index of the bin or C{None} if no bin exists yet and
          {create} is C{False}."""
        if len(self._bins) == 0:
            if not create:
                result = None
            else:
                self._min = int(num / self._bin_width) * self._bin_width
                self._max = self._min + self._bin_width
                self._bins = [0]
                result = 0
            return result

        if num >= self._min:
            binidx = int((num - self._min) / self._bin_width)
            if binidx < len(self._bins):
                return binidx
            if not create:
                return None
            extra_bins = binidx - len(self._bins) + 1
            self._bins.extend([0] * extra_bins)
            self._max = self._min + len(self._bins) * self._bin_width
            return binidx

        if not create:
            return None

        extra_bins = int(math.ceil((self._min - num) / self._bin_width))
        self._bins[0:0] = [0] * extra_bins
        self._min -= extra_bins * self._bin_width
        self._max = self._min + len(self._bins) * self._bin_width
        return 0
def _get_bin ( self , num , create = False ) : if len ( self . _bins ) == 0 : if not create : result = None else : self . _min = int ( num / self . _bin_width ) * self . _bin_width self . _max = self . _min + self . _bin_width self . _bins = [ 0 ] result = 0 return result if num >= self . _min : binidx = int ( ( num - self . _min ) / self . _bin_width ) if binidx < len ( self . _bins ) : return binidx if not create : return None extra_bins = binidx - len ( self . _bins ) + 1 self . _bins . extend ( [ 0 ] * extra_bins ) self . _max = self . _min + len ( self . _bins ) * self . _bin_width return binidx if not create : return None extra_bins = int ( math . ceil ( ( self . _min - num ) / self . _bin_width ) ) self . _bins [ 0 : 0 ] = [ 0 ] * extra_bins self . _min -= extra_bins * self . _bin_width self . _max = self . _min + len ( self . _bins ) * self . _bin_width return 0