New submission from Евгений Jen <jen.soft.mas...@gmail.com>:

# use
if users.get(uid, None) as profile != None:
    ...

# instead
profile = users.get(uid, None)
if profile != None:
    ...


# full-sample:

>>> users = {1: {"name": "Jen"}}
... uid = 1
... 
... # current syntax:
... profile = users.get(uid, None)
... if profile != None:
...     print(f"user: {profile['name']}")
... #
... 
... # new:
... if users.get(uid, None) as profile != None:
...     print(f"user: {profile['name']}")
... #
...

----------
components: Interpreter Core
messages: 385178
nosy: jen.soft.master
priority: normal
severity: normal
status: open
title: new "if-as" syntax
type: enhancement
versions: Python 3.10

_______________________________________
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