[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87v80k6267.fsf@nvidia.com>
Date: Thu, 1 Aug 2024 11:02:40 +0200
From: Petr Machata <petrm@...dia.com>
To: Jakub Kicinski <kuba@...nel.org>
CC: Petr Machata <petrm@...dia.com>, <davem@...emloft.net>,
<netdev@...r.kernel.org>, <edumazet@...gle.com>, <pabeni@...hat.com>,
<sdf@...ichev.me>, <shuah@...nel.org>
Subject: Re: [PATCH net-next v2] selftests: net: ksft: print more of the
stack for checks
Jakub Kicinski <kuba@...nel.org> writes:
> On Wed, 31 Jul 2024 13:07:26 +0200 Petr Machata wrote:
>> > + started |= frame.function == 'ksft_run'
>>
>> Hmm, using bitwise operations on booleans is somewhat unusual in Python
>> I think, especially if here the short-circuiting of "or" wouldn't be a
>> problem. But it doesn't degrade to integers so I guess it's well-defined.
>
> Right, I thought the automatic conversions to booleans are sometimes
> considered in poor taste in Python, but wasn't aware that bitwise ops
> may be frowned upon. IIUC the alternative would be:
FWIW I checked with a proper Pythonist in the meantime, and it's not
just me :)
Also, it's not bitwise ops per se. When doing bit twiddling on integrals
it would be totally legit. It's the part where we are dealing with
booleans that makes it unfashionable.
>
> if frame.function == 'ksft_run':
> started = True
>
> or
>
> started = started or frame.function == 'ksft_run'
I'd prefer the former.
Powered by blists - more mailing lists