Steven D'Aprano <[email protected]> added the comment:
Use the walrus operator:
if profile := users.get(uid, None) is not None:
print(f"user: {profile['name']}")
----------
nosy: +steven.daprano
resolution: -> rejected
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue42954>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com