File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -587,6 +587,19 @@ hierarchies.
587587
588588A workaround would be to write ``a.foo?.__call__(arguments) ``.
589589
590+ ``None ``-assert operator
591+ ------------------------
592+
593+ Some languages with "``null ``-aware" operators also have a "``not-null ``
594+ assertion" operator ``! ``, e.g. TypeScript [#ts_non_null ]_ and Dart [#dart ]_.
595+ It was proposed to add a "``None ``-assert" operator ``! ``. This would
596+ be especially useful in typed Python code where type checkers are not
597+ able to statically deduce that a variable, with an ``optional `` (can be
598+ ``None ``) value, cannot be ``None `` in some contexts.
599+
600+ This PEP focuses on the ``None ``-aware access operators and therefore
601+ this proposal is out of scope.
602+
590603Add ``list.get(key) ``
591604---------------------
592605
@@ -1190,6 +1203,8 @@ Footnotes
11901203 (https://discuss.python.org/t/introducing-a-safe-navigation-operator-in-python/35480)
11911204 .. [#ts ] TypeScript: Optional Chaining
11921205 (https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#optional-chaining)
1206+ .. [#ts_non_null ] TypeScript: Non-null Assertion Operator
1207+ (https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#non-null-assertion-operator-postfix-)
11931208 .. [#js ] JavaScript: Optional chaining (?.)
11941209 (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining)
11951210 .. [#js_short_circuiting ] JavaScript: Optional chaining (?.) - Short-circuiting
You can’t perform that action at this time.
0 commit comments