Talin <[EMAIL PROTECTED]> wrote: > 6) Although I would not want to propose that Python adopt C's > 'assignment is an expression' behavior, I find myself constantly > wanting to combine the following two statements into one: > > m = re.match( ... ) > if m: > # do something with m
I'm sure you were talking more generically, but as for this specific case (which is indeed very common), I always wondered why re couldn't export wrappers around bound methods of the last match object, so to allow: if re.match(...): x,y = re.group(1), re.group(2) elif re.match(..): ... There are many other modules in standard library which exposes a function-based interface where the functions are actually bound methods of a static object (logging, for instance). If "re" gained this, it'd be great. In fact, this could probably be done in 2.x as well. Giovanni Bajo _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com