Re: [Pyparsing] Proposed notational shortcut for setResultsName
Brought to you by:
ptmcg
From: Ralph C. <ra...@in...> - 2007-05-24 23:38:55
|
Hi Paul, > So how about adding a shortcut for setResultsName, using getitem? With this > short cut, this code: > > userdata = Word(alphas).setResultsName("name") + > Word(nums+"-").setResultsName("socsecno") > > could be written as: > > userdata = Word(alphas)["name"] + Word(nums+"-")["socsecno"] It just seems odd to use getitem to "set" something, i.e. the results name. What about having "_" as an attribute function instead so it isn't too obtrusive? userdata = Word(alphas)._("name") + Word(nums+"-")._("socsecno") Or userdata = Word(alphas, n = "name") + Word(nums+"-", n = "socsecno") Cheers, Ralph. |