Skip to main content
PyPI Package latest release Supported versions Supported implementations Wheel packaging support Test line coverage

It’s been almost fifty years since C introduced printf() and the basic formatted printing of positional parameters. Isn’t it time for an upgrade? You betcha!

say evolves Python’s print statement/function, format function/method, and % string interpolation operator with simpler, higher-level facilities. For example, it provides direct template formatting:

from say import *

x, nums, name = 12, list(range(4)), 'Fred'

say("There are {x} things.")
say("Nums has {len(nums)} items: {nums}")
say("Name: {name!r}")

yields:

There are 12 things.
Nums has 4 items: [0, 1, 2, 3]
Name: 'Fred'

Or instead of printing the string immediately, you want the string itself, the fmt() function is our version of sprintf().:

>>> fmt("{name} has {x} things and {len(nums)} numbers.")
'Fred has 12 things and 4 numbers.'

The more items being printed, and the more complicated the format invocation, the more valuable this simple inline specification becomes.

But as nice as replacing positional templates with inline templates is–a fact finally officially accommodated with formatted string literals of Python 3.6–say does a lot more. It also works in a variety of ways to up-level the output-generation task. For example:

say.title('Discovered')
say("Name: {name:style=blue}", indent='+1')
say("Age:  {age:style=blue}", indent='+1')

Prints a nicely formatted text block, with a proper title and indentation, and just the variable information in blue.

http://content.screencast.com/users/jonathaneunice/folders/Jing/media/81bf4738-c875-4998-82ac-a91d211d000b/00000745.png

say provides:

  • DRY, Pythonic, inline string templates that piggyback Python’s well-proven 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.

Take it for a test drive today! See the full documentation at Read the Docs.

Metadata

Release files for say 1.6.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for say 1.6.6
File Size Uploaded
say-1.6.6.tar.gz 46.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for say 1.6.6
File Interpreter ABI Platform
say-1.6.6-py3-none-any.whl Python 3 none any Details

Total release size: 66.4 kB

Release files / say-1.6.6.tar.gz

Download URL say-1.6.6.tar.gz
Size 46.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a8a8dc85e99f2b1e78e4a6d755f7b555833f41812ba788a4b3c5eb8ad1d03262
BLAKE2b-256 checksum
How to use checksums
f6b66a5445ca37d13addb30953ee79aea3f3e67e67360460e4d6e6b8235b40ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.7.2

Release files / say-1.6.6-py3-none-any.whl

Download URL say-1.6.6-py3-none-any.whl
Size 19.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1290d85a9807271e1266580bb1b18ed938541f6ea446dd090941ca7255b984b8
BLAKE2b-256 checksum
How to use checksums
828f6ace10e0e24143dd9e441a7457dc74451202fdecc2b5ae537a9e02e773e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.7.2

Release history Release notifications | RSS feed

This release

1.6.6 This release

2 release files

1.6.5

2 release files

1.6.4

2 release files

1.6.3

2 release files

1.6.2

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.5

2 release files

1.4.4

2 release files

1.4.3

2 release files

1.4.2

3 release files

1.4.1

3 release files

1.4.0

3 release files

1.3.10

3 release files

1.3.9

3 release files

1.3.8

3 release files

1.3.7

3 release files

1.3.6

3 release files

1.3.5

3 release files

1.3.4

3 release files

1.3.3

3 release files

1.3.2

3 release files

1.3.1

3 release files

1.3.0

2 release files

1.2.7

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page