@PythonPros
Python Pros
3 years
Did you know about the walrus🦭 operator in python? 📃Use the walrus operator `:=` to assign values to variables within an expression. ✨For example: `if (n := len(a)) > 10: print(f"List is too long ({n} elements)")` Follow for more #tricks #Python
1
0
3

Replies

@john_franey
John Franey
3 years
@PythonPros auto-walrus ( https://t.co/dCFsfu1kku) is a tool that can refactor Python code to use the walrus operator. (You can try it out in your browser with Pyrfecter, a site of mine, too! https://t.co/z5PSz6s6o8)
0
0
1