This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients barry, ben11kehoe, serhiy.storchaka
Date 2022-01-09.22:39:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1641767996.68.0.462664535252.issue46307@roundup.psfhosted.org>
In-reply-to
Content
The simplest way of collecting template names is to use a defaultdict:

>>> d = collections.defaultdict(str)
>>> string.Template('$a $b').substitute(d)
' '
>>> d.keys()
dict_keys(['a', 'b'])

You can use a custom mapping if you need special handling of absent keys.
History
Date User Action Args
2022-01-09 22:39:56serhiy.storchakasetrecipients: + serhiy.storchaka, barry, ben11kehoe
2022-01-09 22:39:56serhiy.storchakasetmessageid: <1641767996.68.0.462664535252.issue46307@roundup.psfhosted.org>
2022-01-09 22:39:56serhiy.storchakalinkissue46307 messages
2022-01-09 22:39:56serhiy.storchakacreate