Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #42244
| Date | 2013-03-29 09:49 -0400 |
|---|---|
| From | Mitya Sirenef <msirenef@lightbird.net> |
| Subject | Re: Doing both regex match and assignment within a If loop? |
| References | <f8598e49-67af-4a97-98db-9fd69d0182ae@googlegroups.com> <kj3j8n$urg$1@ger.gmane.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3947.1364564977.2939.python-list@python.org> (permalink) |
On 03/29/2013 04:27 AM, Peter Otten wrote: > (2) > import re > > class Matcher: > def __call__(self, expr, line): > result = self.match = expr.match(line) > return result > def __getattr__(self, name): > return getattr(self.match, name) Perhaps it's a little simpler to do this? > self.match = expr.match(line) > return self.match -m -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ Frisbeetarianism is the belief that when you die, your soul goes up on the roof and gets stuck. George Carlin
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Doing both regex match and assignment within a If loop? Victor Hooi <victorhooi@gmail.com> - 2013-03-28 21:00 -0700
Re: Doing both regex match and assignment within a If loop? Chris Rebert <clp2@rebertia.com> - 2013-03-28 21:29 -0700
Re: Doing both regex match and assignment within a If loop? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-29 06:45 +0000
Re: Doing both regex match and assignment within a If loop? Peter Otten <__peter__@web.de> - 2013-03-29 09:27 +0100
Re: Doing both regex match and assignment within a If loop? Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2013-03-29 11:06 +0100
Re: Doing both regex match and assignment within a If loop? Arnaud Delobelle <arnodel@gmail.com> - 2013-03-29 10:41 +0000
Re: Doing both regex match and assignment within a If loop? Neil Cerutti <neilc@norwich.edu> - 2013-03-29 12:51 +0000
Re: Doing both regex match and assignment within a If loop? Mitya Sirenef <msirenef@lightbird.net> - 2013-03-29 09:49 -0400
csiph-web