[Chicago] PEP 0498

Brian Ray brianhray at gmail.com
Mon Aug 17 08:25:55 CEST 2015


I kinda like this idea:

>>> import datetime
>>> name = 'Fred'
>>> age = 50
>>> anniversary = datetime.date(1991, 10, 12)
>>> f'My name is {name}, my age next year is {age+1}, my anniversary is {anniversary:%A, %B %d, %Y}.'
'My name is Fred, my age next year is 51, my anniversary is Saturday,
October 12, 1991.'
>>> f'He said his name is {name!r}.'
"He said his name is 'Fred'."

I am not so sure about putting python code inside the strings is a good
idea; but, overall I like the concept, as I found myself type .format() an
awful lot lately.


ref: https://www.python.org/dev/peps/pep-0498/



-- 
Brian Ray
@brianray
(773) 669-7717
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20150817/7d2d6f21/attachment.html>


More information about the Chicago mailing list