How to do this in Python...

CezaryB cezary at
Fri Jan 24 08:11:33 CET 2003

Paul Rubin wrote:
> "Michael Tiller" <mtiller at> writes:
> Tim Peters suggested one a few days ago:
>    if [match for match in [re.match(pattern,string)]][0]:
>         # do something with match object

No, he was afraid of it. :-)

Mixing test with assigment is considered bad style in C/C++ and othen 
indicates an error.


More information about the Python-list mailing list