Thread (4 messages) 4 messages, 2 authors, 2024-08-01

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

From: Petr Machata <petrm@nvidia.com>
Date: 2024-08-01 09:08:42

Jakub Kicinski [off-list ref] writes:
On Wed, 31 Jul 2024 13:07:26 +0200 Petr Machata wrote:
quoted
quoted
+            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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help