[Python-ideas] string.format() default variable assignment

random832 at fastmail.us random832 at fastmail.us
Fri Mar 1 18:11:31 CET 2013


On Fri, Mar 1, 2013, at 11:55, 김용빈 wrote:

why we bother with '{variable}'.format(variable=variable) ?
can we just '{variable}.format()' ?

if variable is exist, then assign it.
if variable is not exist, then raise error

I am not language expert. so sorry if this is not a good idea, or
already discussed.

_______________________________________________

Python-ideas mailing list

[1]Python-ideas at python.org

[2]http://mail.python.org/mailman/listinfo/python-ideas





If you don't want to repeat a name multiple times, just use
'{0}'.format(variable)



The format function doesn't (i think?) have a way to see your local
variables to look up the name.

References

1. mailto:Python-ideas at python.org
2. http://mail.python.org/mailman/listinfo/python-ideas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130301/c76c88b6/attachment.html>


More information about the Python-ideas mailing list