|
|
|
|
|
by robertlagrant
403 days ago
|
|
And the same in Python: if user := get_user() is not None:
# use user
else:
# return error
Although given the happy path code can mean you don't see the error condition for ages, I much prefer this: if (user := get_user()) is None:
# return error
# use user
|
|
It actually looks really natural in python, glad they added.