Re: Assignment-in-conditional
- From: Georg Brandl <g.brandl-nospam@xxxxxxx>
- Date: Thu, 31 Aug 2006 22:07:47 +0200
xamdam wrote:
I am not sure if this came up before, but I would love to have an
'assignment-in-conditional' form in python, e.g
pat = re.compile('something')
if m = pat.match(s):
m.group(1)
Of course there is some concern about accidentally using '=' instead of
'=='. One possible solution is to do what the 'with' statement does:
if pat.match(s) as m:
...
a little ugly but not too much worse that with itself..
what do you guys think?
It has been proposed before (a few times even), and Guido doesn't like it.
Georg
.
- Prev by Date: Re: Assignment-in-conditional
- Next by Date: Re: Assignment-in-conditional
- Previous by thread: Re: Assignment-in-conditional
- Index(es):