
Oct. 11, 2008
12:09 a.m.
Proposed is the addition of one new attribute, and one new function, on the existing Template class, as follows:
1. 'greedy' is a new attribute that determines whether the field matches should be done in a greedy manner, equivalent to regex pattern '(.*)'; or in a non-greedy manner, equivalent to '(.*?)'. This attribute defaults to false.
I don't want to commit to whether this should be in the stdlib or not, but on the design part I'd say it would be better to make 'greedy' an optional parameter to the match method. It's only used in one method and not really a property of the template, but of the matching:
print s.match('Guido was born in the Netherlands', greedy=True)
Jan