which python trick or hack you know that you would want to share?

whoareu@lemmy.ca to Programming@programming.dev – 94 points –
45

You are viewing a single comment

Walrus operator - := - envious of the C devs being able to simultaneously assign and return a value? Envy no more, we've got it.

For those curious about the drama & lack of wide adoption surrounding the walrus operator

https://dev.to/renegadecoder94/the-controversy-behind-the-walrus-operator-in-python-4k4e

It's a shame because it's a really nice feature.

You need to see it to believe it I think. I was generally on the side of “too complex” but then came across instances perfect for it and used it right away and found it pleasant.

I’m still generally on the side of “too complex” though, and think there are probably better things for PSF to work on (cough packaging cough).