New-style string formatting

Bengt Richter bokr at oz.net
Wed May 21 01:35:20 EDT 2003


On Tue, 20 May 2003 15:13:03 -0500, Skip Montanaro <skip at pobox.com> wrote:
[...]
>    >> There's nothing mnemonic in the construct to suggest what you want to
>    >> do.
>
>    Gerrit> True. Mnemonic would be to create a ".format" method.
>
>According to the definition I found for "mnemonic" via Google, as an
>adjective it means:
>
>    Relating to, assisting, or intended to assist the memory.
>
>In that sense, "%" is mnemonic for me because it reminds me of the %-strings
>in C printf() format strings.  "format" is descriptive.  It would probably
>be as good a choice as either syntactic construct, largely because it's more
>explicit and requires less knowledge of convention or printf().
>
>    >> The % operator at least has the syntactic connection to C's printf()
>    >> function.
>
IMO a better mnemonic would be .freplace -- for formatted replace. After all,
% is effectively doing a complicated replace function on %<something>s elements
in the string and returning the end result.

Regards,
Bengt Richter




More information about the Python-list mailing list