New syntax for blocks
tjreedy at udel.edu
Wed Nov 11 06:44:55 CET 2009
Carl Banks wrote:
> r didn't actually give a good example. Here is case where it's
> actually useful. (Pretend the regexps are too complicated to be
> parsed with string method.)
> if re.match(r'go\s+(north|south|east|west)',cmd) as m:
> elif re.match(r'take\s+(\w+)',cmd) as m:
> elif re.match(r'drop\s+(\w+)',cmd) as m:
The effect of this proposal can already be accomplished with a 'pocket'
class as has been posted before and again in a slightly different form
in Steve's post.
More information about the Python-list