On May 21, 11:38 am, [EMAIL PROTECTED] wrote:

> if (match = my_re1.match(line):
>   # use match
> elsif (match = my_re2.match(line)):
>   # use match
> elsif (match = my_re3.match(line))
>   # use match
>
> ...buy this is illegal in python.


Assignment expressions is disallowed in Python to protect against a
very common bug in C/C++ programs, the (accidental) confusion of

   if (match = my_re1.match(line))

with

   if (match == my_re1.match(line))

or vice versa.








--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to