:orphan:
.. _s_11PytoRuntime9SignatureV:
``Signature``
=============
A collection of signature components that define a function’s parameters and return type.
.. raw:: html
.. rubric:: Declaration
.. raw:: html
.. rubric:: Discussion
Use the static functions to create a new :swift:symbol:`PytoRuntime.Signature` and then call its instance functions to extend it:
.. code-block:: swift
Method(
name: "my_function",
signature: {
.positionalOrKeyword("string", annotation: interpreter.builtins.str)
.positionalOrKeyword("flag", annotation: interpreter.builtins.bool, default: false)
.returns(interpreter.builtins.None)
},
body: my_function
)
.. rubric:: Properties
.. raw:: html
.. toctree::
:maxdepth: 1
s_11PytoRuntime9SignatureV10componentsSayAA0C9ComponentVGvp
.. raw:: html
The list of signature components.
.. rubric:: Static Properties
.. raw:: html
.. toctree::
:maxdepth: 1
s_11PytoRuntime9SignatureV5emptyACvpZ
.. raw:: html
Returns a signature with no arguments and no return type.
.. rubric:: Functions
.. raw:: html
.. toctree::
:maxdepth: 1
s_11PytoRuntime9SignatureV7keyword_10annotation7defaultACSS_AA8Parsable_pSgAHtF
.. raw:: html
Appends a keyword-only parameter to the signature.
.. raw:: html
.. toctree::
:maxdepth: 1
s_11PytoRuntime9SignatureV10positional_10annotation7defaultACSS_AA8Parsable_pSgAHtF
.. raw:: html
Appends a positional-only parameter to the signature.
.. raw:: html
.. toctree::
:maxdepth: 1
s_11PytoRuntime9SignatureV19positionalOrKeyword_10annotation7defaultACSS_AA8Parsable_pSgAHtF
.. raw:: html
Appends a positional-or-keyword parameter to the signature.
.. raw:: html
.. toctree::
:maxdepth: 1
s_11PytoRuntime9SignatureV7returns10annotationAcA8Parsable_pSg_tF
.. raw:: html
Appends a return value with the given annotation to the signature.
.. raw:: html
.. toctree::
:maxdepth: 1
s_11PytoRuntime9SignatureV10varKeyword_10annotationACSS_AA8Parsable_pSgtF
.. raw:: html
Appends a variable keyword parameter to the signature.
.. raw:: html
.. toctree::
:maxdepth: 1
s_11PytoRuntime9SignatureV13varPositional_10annotationACSS_AA8Parsable_pSgtF
.. raw:: html
Appends a variable positional parameter to the signature.
.. rubric:: Static Functions
.. raw:: html
.. toctree::
:maxdepth: 1
s_11PytoRuntime9SignatureV7keyword_10annotation7defaultACSS_AA8Parsable_pSgAHtFZ
.. raw:: html
Creates a signature with a keyword-only parameter.
.. raw:: html
.. toctree::
:maxdepth: 1
s_11PytoRuntime9SignatureV10positional_10annotation7defaultACSS_AA8Parsable_pSgAHtFZ
.. raw:: html
Creates a signature with a positional-only parameter.
.. raw:: html
.. toctree::
:maxdepth: 1
s_11PytoRuntime9SignatureV19positionalOrKeyword_10annotation7defaultACSS_AA8Parsable_pSgAHtFZ
.. raw:: html
Creates a signature with a positional-or-keyword parameter.
.. raw:: html
.. toctree::
:maxdepth: 1
s_11PytoRuntime9SignatureV7returns10annotationAcA8Parsable_pSg_tFZ
.. raw:: html
Creates a signature that returns a value with the given annotation.
.. raw:: html
.. toctree::
:maxdepth: 1
s_11PytoRuntime9SignatureV10varKeyword_10annotationACSS_AA8Parsable_pSgtFZ
.. raw:: html
Creates a signature with a variable keyword parameter.
.. raw:: html
.. toctree::
:maxdepth: 1
s_11PytoRuntime9SignatureV13varPositional_10annotationACSS_AA8Parsable_pSgtFZ
.. raw:: html
Creates a signature with a variable positional parameter.
.. rubric:: Conforms to
- ``Sequence``