[Python-Dev] Replacement for print in Python 3.0

Guido van Rossum guido at python.org
Tue Sep 6 16:23:52 CEST 2005


On 9/6/05, Barry Warsaw <barry at python.org> wrote:
> printf('$1 forgot to frobnicate the $2!\n', username, file.name,
>        to=sys.stderr)
> 
> While that's a little less self-descriptive for a translator to deal
> with (who would only see the string, not the call site), it certainly
> looks nicer for a non-i18n application, and could certainly work for an
> i18n app too.  It's a neat idea worth exploring.

Is it worth doing this and completely dropping the %-based formats in
Py3k? (Just asking -- it might be if we can get people to get over the
shock of $ becoming first class ;-).

> Also, I think you posted in a separate article a syntactic proposal for
> including detailed formating in $-vars.  ${varname:fmt} where 'varname'
> could be an identifier a la PEP 292 or possibly a positional argument.

+1

I proposed ${varname%fmt} earlier but it prevents you to extend the
varname syntax to arbitrary expressions, which I think is an extension
that will get lots of requests.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list