[Python-Dev] Can we please have a better dict interpolation syntax?

Guido van Rossum guido at python.org
Wed Oct 22 22:28:59 EDT 2003


> I have just had the experience of writing a bunch
> of expressions of the form
> 
>   "create index %(table)s_lid1_idx on %(table)s(%(lid1)s)" % params
> 
> and found myself getting quite confused by all the parentheses
> and "s" suffixes. I would *really* like to be able to write
> this as
> 
>   "create index %{table}_lid1_idx on %{table}(%{lid1})" % params
> 
> which I find to be much easier on the eyes.

Wouldn't this be even better?

    "create index ${table}_lid1_idx on $table($lid1)" % params

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



More information about the Python-Dev mailing list