[Python-ideas] A "local" pseudo-function

Kirill Balunov kirillbalunov at gmail.com
Sun Apr 29 13:23:38 EDT 2018


2018-04-29 17:52 GMT+03:00 MRAB <python at mrabarnett.plus.com>:
>
>
>> How about these:
>
>     local m1, m2:
>         m1 = regexp1.match(line)
>         m2 = regexp2.match(line):
>         if m1 and m2:
>             ...
>

Is it possible to do the same thing, but with the help of `with` statement:

with local('m1', 'm2'):

m1 = regex1.match(line)
m2 = regex2.match(line)
if m1 and m2:

...


With kind regards,
-gdg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180429/9e33a242/attachment.html>


More information about the Python-ideas mailing list