Steven D'Aprano <steve+pyt...@pearwood.info> 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 <rep...@bugs.python.org>
<https://bugs.python.org/issue42954>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to