[Python-checkins] peps: Show example of 2.7 syntax for argument-less function, and mention skipping
guido.van.rossum
python-checkins at python.org
Tue Mar 22 21:12:23 EDT 2016
https://hg.python.org/peps/rev/20a5ecc515c0
changeset: 6268:20a5ecc515c0
user: Guido van Rossum <guido at python.org>
date: Tue Mar 22 18:12:14 2016 -0700
summary:
Show example of 2.7 syntax for argument-less function, and mention skipping 'self'.
files:
pep-0484.txt | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/pep-0484.txt b/pep-0484.txt
--- a/pep-0484.txt
+++ b/pep-0484.txt
@@ -1466,6 +1466,14 @@
"""Embezzle funds from account using fake receipts."""
<code goes here>
+Note that for methods, no type is needed for ``self``.
+
+For an argument-less method it would look like this::
+
+ def load_cache(self):
+ # type: () -> bool
+ <code>
+
Sometimes you want to specify the return type for a function or method
without (yet) specifying the argument types. To support this
explicitly, the argument list may be replaced with an ellipsis.
--
Repository URL: https://hg.python.org/peps
More information about the Python-checkins
mailing list