Carl Banks wrote:
Right.  But you know that as soon as you add this to simple
expressions, a bunch of people are going to come here whining about how
they don't get to use where with if-expressions.

Frankly, they might have a point here.  Although we have replacing
lambda expressions on our minds, I have in mind a different problem
that a where-statement would solve perfectly.  But it would have to be
used with an if-expression.

I have a different suggestion for this.

'as' is used for renaming in import statements. 'as' will be used for exception naming in Python 3k.

So let's use it for expression naming in 'if' statements, too.

if someregexp.match(s) as m:
  # blah using m
elif someotherregexp.match(s) as m:
  # blah using m

Cheers,
Nick.

--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
            http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to