netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Machata <petrm@nvidia.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Petr Machata <petrm@nvidia.com>, <davem@davemloft.net>,
	<netdev@vger.kernel.org>, <edumazet@google.com>,
	<pabeni@redhat.com>, <sdf@fomichev.me>, <shuah@kernel.org>
Subject: Re: [PATCH net-next v2] selftests: net: ksft: print more of the stack for checks
Date: Thu, 1 Aug 2024 11:02:40 +0200	[thread overview]
Message-ID: <87v80k6267.fsf@nvidia.com> (raw)
In-Reply-To: <20240731074814.7043d9ac@kernel.org>


Jakub Kicinski <kuba@kernel.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.

      reply	other threads:[~2024-08-01  9:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-31  1:33 [PATCH net-next v2] selftests: net: ksft: print more of the stack for checks Jakub Kicinski
2024-07-31 11:07 ` Petr Machata
2024-07-31 14:48   ` Jakub Kicinski
2024-08-01  9:02     ` Petr Machata [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v80k6267.fsf@nvidia.com \
    --to=petrm@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).