Dec. 7, 2006
7:16 p.m.
On Thu, Dec 07, 2006, Alastair Houghton wrote:
An example where it might be useful:
m = re.match('(?:([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+) (?P<rect>rect)' '|([0-9]+) ([0-9]+) ([0-9]+) (?P<circle>circle))', lineFromFile)
if m['rect']: drawRectangle(m[1:5]) elif m['circle']: drawCircle(m[1:3], m[3])
Is that really so outlandish?
Likely; normally I would expect that drawRectangle would break on string arguments instead of ints. I think that the amount of usefulness compared to problems doesn't really make this worth it. -- Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/ Member of the Groucho Marx Fan Club