Login | Register
My pages Projects Community openCollabNet
Package commitmessage :: Module Itpl :: Class Itpl
[show private | hide private]
[frames | no frames]

Class Itpl


Class representing a string with interpolation abilities.

Upon creation, an instance works out what parts of the format string are literal and what parts need to be evaluated. The evaluation and substitution happens in the namespace of the caller when str(instance) is called.
Method Summary
  __init__(self, format)
The single argument to this constructor is a format string.
  __repr__(self)
  __str__(self)
Evaluate and substitute the appropriate parts of the string.

Method Details

__init__(self, format)
(Constructor)

The single argument to this constructor is a format string.

The format string is parsed according to the following rules:

1.  A dollar sign and a name, possibly followed by any of: 
      - an open-paren, and anything up to the matching paren 
      - an open-bracket, and anything up to the matching bracket 
      - a period and a name 
    any number of times, is evaluated as a Python expression.

2.  A dollar sign immediately followed by an open-brace, and
    anything up to the matching close-brace, is evaluated as
    a Python expression.

3.  Outside of the expressions described in the above two rules,
    two dollar signs in a row give you one literal dollar sign.

__str__(self)
(Informal representation operator)

Evaluate and substitute the appropriate parts of the string.

Generated by Epydoc 2.1 on Thu Jan 06 10:30:34 2005 http://epydoc.sf.net