Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.058 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; 'subject:skip:s 10': 0.07; 'identifier': 0.09; 'template.': 0.09; 'template': 0.14; 'identifiers': 0.16; 'this?': 0.23; 'header:User-Agent:1': 0.23; '---': 0.24; 'expansion': 0.30; "i'm": 0.30; 'i.e.': 0.36; 'in.': 0.36; 'thanks': 0.36; 'filled': 0.38; 'handle': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'building,': 0.68; 'recognition': 0.84; 'speech': 0.84 X-Virus-Scanned: amavisd-new at harvee.org Date: Sun, 12 Jan 2014 10:08:31 -0500 From: "Eric S. Johansson" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: python-list@python.org Subject: extracting string.Template substitution placeholders Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 10 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1389539678 news.xs4all.nl 2885 [2001:888:2000:d::a6]:43733 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:63776 As part of speech recognition accessibility tools that I'm building, I'm using string.Template. In order to construct on-the-fly grammar, I need to know all of the identifiers before the template is filled in. what is the best way to do this? can string.Template handle recursive expansion i.e. an identifier contains a template. Thanks --- eric