Jim Jewett wrote:
> You can't write int(s) if you're passing a mapping (or tuple) from
> someone else; at best you can copy the mapping and modify certain
> values.

Maybe this could be handled using a wrapper object that
takes a sequence or mapping and a collection of functions
to be applied to specified items.

    "i = {0}, x = {1}".format(convert(stuff, int, float))

or using names

    "i = {i}, x = {x}".format(convert(stuff, i = int, x = float))

This would have the advantage of allowing arbitrarily
complex conversions while keeping the potentially verbose
specifications of those conversions out of the format
string. Plus the convert() wrapper could be useful in its
own right for other things besides formatting.

--
Greg
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to