Next / Previous / Contents / TCC Help System / NM Tech homepage

44.3. StatCell._display(): What text should appear?

The .value attribute of a StatCell may be in one of three states:

cbchistlib.py
# - - -   S t a t C e l l . _ d i s p l a y

    def _display(self):
        '''Determine text to be displayed.

          [ if self.value is a string ->
              return self.value
            else if self.value <= 0 ->
              return '-'
            else ->
              return self.value as a string, without excessive precision ]
        '''
        #-- 1
        if isinstance(self.value, basestring):
            return self.value
        elif self.value <= 0.0:
            return '-'
        else:
            return statNumber(self.value)