4 ms·
This is a very popular pattern in python where you'd introduce _variable before the evalution so: if (user.id < 4 and user.session): ... # you'd do _u
by wraptile 1y ago
This is a very popular pattern in python where you'd introduce _variable before the evalution so:
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!