mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
gh-115808: Add `is_none
and
is_not_none
to
operator
` (#115814)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
This commit is contained in:
parent
0fd97e46c7
commit
5580f31c56
7 changed files with 107 additions and 3 deletions
|
@ -14,8 +14,8 @@ __all__ = ['abs', 'add', 'and_', 'attrgetter', 'call', 'concat', 'contains', 'co
|
|||
'delitem', 'eq', 'floordiv', 'ge', 'getitem', 'gt', 'iadd', 'iand',
|
||||
'iconcat', 'ifloordiv', 'ilshift', 'imatmul', 'imod', 'imul',
|
||||
'index', 'indexOf', 'inv', 'invert', 'ior', 'ipow', 'irshift',
|
||||
'is_', 'is_not', 'isub', 'itemgetter', 'itruediv', 'ixor', 'le',
|
||||
'length_hint', 'lshift', 'lt', 'matmul', 'methodcaller', 'mod',
|
||||
'is_', 'is_none', 'is_not', 'is_not_none', 'isub', 'itemgetter', 'itruediv',
|
||||
'ixor', 'le', 'length_hint', 'lshift', 'lt', 'matmul', 'methodcaller', 'mod',
|
||||
'mul', 'ne', 'neg', 'not_', 'or_', 'pos', 'pow', 'rshift',
|
||||
'setitem', 'sub', 'truediv', 'truth', 'xor']
|
||||
|
||||
|
@ -66,6 +66,14 @@ def is_not(a, b):
|
|||
"Same as a is not b."
|
||||
return a is not b
|
||||
|
||||
def is_none(a):
|
||||
"Same as a is None."
|
||||
return a is None
|
||||
|
||||
def is_not_none(a):
|
||||
"Same as a is not None."
|
||||
return a is not None
|
||||
|
||||
# Mathematical/Bitwise Operations *********************************************#
|
||||
|
||||
def abs(a):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue