File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -660,6 +660,22 @@ and this is also the suggested default when the program is being
660
660
type-checked.
661
661
662
662
663
+ Default argument values
664
+ -----------------------
665
+
666
+ In stubs it may be useful to declare an argument as having a default
667
+ without specifying the actual default value. For example::
668
+
669
+ def foo(x: AnyStr, y: AnyStr = ...) -> AnyStr: ...
670
+
671
+ What should the default value look like? Any of the options ``""``,
672
+ ``b""`` or ``None`` fails to satisfy the type constraint (actually,
673
+ ``None`` will *modify* the type to become ``Optional[AnyStr]``).
674
+
675
+ In such cases the default value may be specified as a literal
676
+ ellipsis, i.e. the above example is literally what you would write.
677
+
678
+
663
679
Compatibility with other uses of function annotations
664
680
=====================================================
665
681
You can’t perform that action at this time.
0 commit comments