It’s been forty five years since
printf() and the basic
formatted printing of positional parameters. Isn’t it time for an upgrade?
say evolves Python’s
format function/method, and
interpolation operator with simpler, higher-level facilities. For example,
it provides direct template formatting:
- DRY, Pythonic, inline string templates that piggyback
format()method, syntax, and underlying engine.
- A single output mechanism that works the same way across Python 2 or Python 3.
- A companion
fmt()object for string formatting.
- Higher-order line formatting such as line numbering, indentation, and line-wrapping built in. You can get substantially better output formatting with almost no additional code.
- Convenient methods for common formatting items such as titles, horizontal separators, and vertical whitespace.
- Easy styled output, including ANSI colors and user-defined styles and text transforms.
- Easy output to one or more files, without additional code or complexity.
- Super-duper template/text aggregator objects for easily building, reading, and writing multi-line texts.
- Indentation and Wrapping
- Prefixes and Suffixes
- The Value Proposition
- Titles and Horizontal Rules
- Vertical Spacing
- Colors and Styles
- Where and When You Like
- Non-Functional Invocation
- Text and Templates
- Iterpolators and Exceptions
- Python 3
- API Reference
- Change Log