[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABVgOSmiXDS=wGe0XPvr2BDqg+1be43TLFLE8fW79ZNPUYpNYQ@mail.gmail.com>
Date: Thu, 3 Dec 2020 11:06:05 +0800
From: David Gow <davidgow@...gle.com>
To: Daniel Latypov <dlatypov@...gle.com>
Cc: Brendan Higgins <brendanhiggins@...gle.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>,
Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH v2 3/4] kunit: tool: use `with open()` in unit test
On Thu, Dec 3, 2020 at 3:09 AM Daniel Latypov <dlatypov@...gle.com> wrote:
>
> The use of manual open() and .close() calls seems to be an attempt to
> keep the contents in scope.
> But Python doesn't restrict variables like that, so we can introduce new
> variables inside of a `with` and use them outside.
>
> Do so to make the code more Pythonic.
>
> Signed-off-by: Daniel Latypov <dlatypov@...gle.com>
> ---
Reviewed-by: David Gow <davidgow@...gle.com>
Cheers,
-- David
Powered by blists - more mailing lists