Print the variable out. Limit the string length to, by default, 300 characters.
775815
def print_variable(obj, **kwargs):
    """"""
    variable_print_length = kwargs.get("variable_print_length", 1000)
    s = str(obj)
    if len(s) < 300:
        return "Printing the object:\n" + str(obj)
    else:
        return "Printing the object:\n" + str(obj)[:variable_print_length] + ' ...'
1063593
public static String printLong(long l) {
		if (l >= 0) return "" + ((l == APSPSolver.INF ? "INF" : l));
		return "" + (-l == APSPSolver.INF ? "-INF" : l);
	}
817550
def _print_ll(self):
        
        print "#  ",
        for i in range(self.width):
            print "  %4d   "%i,
        print
        for L in ['A', 'C', 'T', 'G']:
            print "#%s "%L,
            for i in range(self.width):
                print  "%8.3f "%self.ll[i][L],
            print
485413
public void printString(String v, int offset, int length)
        throws IOException
    {
        for (int i = 0; i < length; i++) {
            char ch = v.charAt(i + offset);

            if (ch < 0x80)
                os.write(ch);
            else if (ch < 0x800) {
                os.write(0xc0 + ((ch >> 6) & 0x1f));
                os.write(0x80 + (ch & 0x3f));
            }
            else {
                os.write(0xe0 + ((ch >> 12) & 0xf));
                os.write(0x80 + ((ch >> 6) & 0x3f));
                os.write(0x80 + (ch & 0x3f));
            }
        }
    }
74234
def _maxlength(X):
    
    N = 0
    for x in X:
        if len(x) > N:
            N = len(x)
    return N
771143
def print_variables(self):
        
        print_out = partial(self.print_out, format_options='green')

        print_out('===== variables =====')

        for var, hint in self.vars.get_descriptions().items():
            print_out('    %' + var + ' = ' + var + ' = ' + hint.replace('%', '%%'))

        print_out('=====================')

        return self
283726
public void print(long l) throws IOException
  {
    String value = Long.toString(l);
    this.output.write(value.getBytes(), 0, value.length());
  }
369275
def print_number_str(self, value, justify_right=True):
        
        # Calculate length of value without decimals.
        length = len(value.translate(None, '.'))
        # Error if value without decimals is longer than 4 characters.
        if length > 4:
            self.print_str('----')
            return
        # Calculcate starting position of digits based on justification.
        pos = (4-length) if justify_right else 0
        # Go through each character and print it on the display.
        for i, ch in enumerate(value):
            if ch == '.':
                # Print decimal points on the previous digit.
                self.set_decimal(pos-1, True)
            else:
                self.set_digit(pos, ch)
                pos += 1
690893
private String takeString() {
        _string.setLength(_length);
        String s = _string.toString();
        _string.setLength(0);
        _length = -1;
        return s;
    }
736141
def print(string, width = self.width)
      w = width == 0? Ncurses.COLS : width
      waddnstr(string.to_s, w) # changed 2011 dts  
    end
639033
function print() {
        var parts = String(out).split('\n');
        /* istanbul ignore next */
        if (parts.length > 1) {
          out = parts.pop();
          var logging = String(parts.join('\n')).replace(/\r\r/g, '\r');
          slf.log(logging);
        }
        /* istanbul ignore next */
        if (closed === false) {
          setTimeout(function () {
            print();
          }, 50);
        }
      }
774141
public void printLenString(String v)
        throws IOException
    {
        if (SIZE < _offset + 16)
            flushBuffer();

        if (v == null) {
            _buffer[_offset++] = (byte) (0);
            _buffer[_offset++] = (byte) (0);
        }
        else {
            int len = v.length();
            _buffer[_offset++] = (byte) (len >> 8);
            _buffer[_offset++] = (byte) (len);

            printString(v, 0, len);
        }
    }
685034
def truncate(string, width, options={})
      trailing = options[:trailing] || '…'

      chars = string.to_s.chars.to_a
      if chars.length < width && chars.length > 3
        chars.join
      elsif chars.length > 3
        (chars[0, width - trailing.length].join) + trailing
      end
    end
1050356
def to_string_short(self):
        
        if hasattr(self, 'constrained_by') and len(self.constrained_by) > 0:
            return "* {:>30}: {}".format(self.uniquetwig_trunc, self.get_quantity() if hasattr(self, 'quantity') else self.get_value())
        else:
            return "{:>32}: {}".format(self.uniquetwig_trunc, self.get_quantity() if hasattr(self, 'quantity') else self.get_value())
1111817
private static int totalLength(CharSequence... strs) {
		int totalLength = 0;
		for(int i = 0 ; i < strs.length; i++) {
			totalLength += (null == strs[i] ? 4 : strs[i].length());
		}
		return totalLength;
	}
473691
public String str()
  {

    if (null == m_strCache)
    {
      m_strCache = fsb().getString(m_start, m_length);

//      strCount++;
//
//      RuntimeException e = new RuntimeException("Bad!  Bad!");
//      java.io.CharArrayWriter writer = new java.io.CharArrayWriter();
//      java.io.PrintWriter pw = new java.io.PrintWriter(writer);
//
//      e.printStackTrace(pw);
//
//      String str = writer.toString();
//
//      str = str.substring(0, 600);
//
//      if (null == xtable.get(str))
//      {
//        xtable.put(str, str);
//        System.out.println(str);
//      }
//      System.out.println("strCount: " + strCount);

//      throw e;
//      e.printStackTrace();
      // System.exit(-1);
    }

    return m_strCache;
  }
409416
def pretty_print_str(self):
        '''
        
        '''
        retval = ''
        # dfs
        todo = [self.root]
        while todo:
            current = todo.pop()
            for char in reversed(sorted(current.keys())):
                todo.append(current[char])
            indent = ' ' * (current.depth * 2)
            retval += indent + current.__unicode__() + '\n'
        return retval.rstrip('\n')