On 4/30/07, James Thiele <[EMAIL PROTECTED]> wrote:
> For PEP: 3101  - Advanced String Formatting - I would like to suggest
> the following additions.
>
> First, that an additional pair of forms be added to format strings so
> that callable objects could be used as parameters to the format string
> method:
> {0()} for positional arguments and
> {keyword()} for keyword parameters.
> The proposal is that if the format string had this form that the
> format string method would treat the parameter as a callable and use
> the value of the return for the formatting.
>
> The second addition would be the forms
> {0.method()} and
> {keyword.method()}
> where "method" is a method of the object.
>
> This would allow things such as:
> "I want to shout '{0.upper()}'".format("hello world")
> which would yield:
>  "I want to shout 'HELLO WORLD'"

Method calls are deliberately disallowed by the PEP, so that the
implementation has some hope of being securable.

Regards,
Pat
_______________________________________________
Python-3000 mailing list
[email protected]
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