[Python-3000] String formating operations in python 3k
Barry Warsaw
barry at python.org
Tue Apr 4 21:14:34 CEST 2006
On Tue, 2006-04-04 at 14:28 +1200, Greg Ewing wrote:
> If we're going to encourage use of named arguments
> (which I think we should) I think we also need to
> get rid of the need for %(foo)s constructs, which
> are extremely error-prone and hard to read.
In general, I agree.
> I'm -0.7 on having two different formatting
> styles (one using % and the other using $) with
> partially-overlapping functionality. In Py3k
> there should be OOWTDI.
Except that there really are two things going on here. One is
formatting and the other is insertion. I agree it's awkward to have two
styles, but I would really hate to complicate the latter to support the
former. Maybe those who are advocating moving away from in-place
substitution as the mechanism for formatting have the right idea.
> I'm also not all that keen on $, either inside
> or outside the string. It seems to me that
> something like
>
> "User {user} has printed {n} pages"
>
> sets off the parameters from the rest of the
> string more readably than
>
> "User $user has printed $n pages"
Here i disagree. $-strings are so familiar to people coming from other
languages that they instantly "get it".
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 309 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-3000/attachments/20060404/2cbf36c4/attachment.pgp
More information about the Python-3000
mailing list