[Python-3000] locals(), closures, and IronPython...

Guido van Rossum guido at python.org
Tue Mar 6 19:32:59 CET 2007


On 3/6/07, Georg Brandl <g.brandl at gmx.net> wrote:
> While we're at it: I've had a thought about string formatting in Py3k.
> Suppose you do something like
>
> name = "He"
> what = "Ex-Parrot"
> print "{name} is an {what}".format(name=name, what=what)
>
> it seems a bit too verbose. Why not have format() without any arguments
> default to format(**locals())?
>
> This would give those Perl-style interpolation supporters something they
> can live with, and it would be quite handy for common usage.

I think that's a little too terse. **locals() sounds just right to me; EIBTI.

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


More information about the Python-3000 mailing list