if (user.id < 4 and user.session): ...
# you'd do
_user_has_access = (user.id < 4 and user.session) if _user_has_access: ...
# or even walrus
if _user_has_access := (user.id < 4 and user.session): ...
One of my coworkers really liked this pattern and his code was always so easy to read and to this day I'm carrying this torch!
if (user.id < 4 and user.session): ...
# you'd do
_user_has_access = (user.id < 4 and user.session) if _user_has_access: ...
# or even walrus
if _user_has_access := (user.id < 4 and user.session): ...
One of my coworkers really liked this pattern and his code was always so easy to read and to this day I'm carrying this torch!