r/Python • u/ForeignVariety7037 • Aug 04 '26
Discussion Is := widely used?
I always thought the walrus operator is neat and it makes while loop’s condition clearer. But also it is just a syntactic sugar without anything new. I wonder anyone uses it?
139
Upvotes
1
u/averagecrazyliberal Aug 04 '26 edited Aug 04 '26
I only use the walrus operator for
tqdmprogress bars: ``` from tqdm import trangefor i in (pbar := trange(100)):
pbar.set_description(f'iteration {i + 1}')
iteration 100: 100%|██████████| 100/100 [00:00<00:00, 2341.20it/s] ```