Subject: Re: [PATCH net-next v2] selftests: net: ksft: print more of the stack for checks

From: Petr Machata <[email-masked]>
Date: Thu, 1 Aug 2024 11:02:40 +0200

Jakub Kicinski <[email-masked]> 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.