Gary Wessle a écrit :
> Hi
> 
> is there a way to make an assignment in the condition of "if" and use
> it later

No.

>, e.g.
> 
> nx = re.compile('regex')
> if nx.search(text):
>    funCall(text, nx.search(text))
> 
> nx.search(text) is evaluated twice, I was hoping for something like
> 
> nx = re.compile('regex')
> if x = nx.search(text):
>    funCall(text, x))

x = nx.search(text)
if x:
   funCall(text, x)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to