DEV Community

Konstantin vz'One Enchant
Konstantin vz'One Enchant

Posted on

Checking overhead for walrus operator (:=) in Python

Purely for myself, I decided to check whether there is an overheat when using walrus (:=) in Python:

Timeit for warlus in Python

At least it works no slower, which is already pleasing.

If you look deeper, you can see that when using the walrus, the LOAD_FAST instruction is missing, it is, as it were, replaced by DUP_TOP, which in theory should work a little faster.

Top comments (0)

Feature flag article image

Create a feature flag in your IDE in 5 minutes with LaunchDarkly’s MCP server 🏁

How to create, evaluate, and modify flags from within your IDE or AI client using natural language with LaunchDarkly's new MCP server. Follow along with this tutorial for step by step instructions.

Read full post

👋 Kindness is contagious

Sign in to DEV to enjoy its full potential—unlock a customized interface with dark mode, personal reading preferences, and more.

Okay