Carl Banks <[EMAIL PROTECTED]> writes: > > >> import re > > >> pat = re.compile('some pattern') > > >> if m = pat.match(some_string): > > >> do_something(m) > >... > Don't be ridiculous. Assignment operators are maybe one of the worst > things in existence, but this particular use case (running a sequence > of tests like the above) is perfectly useful and good.
I've been known to do stuff like: class xmatch: def set(self, v): self.v = v return v then: s = xmatch() if s.set(pat.match(some_string)): do_something(s.v) elif s.set(pat.match(other_string)): do_other_thing(s.v) ... -- http://mail.python.org/mailman/listinfo/python-list