Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pythonlings/docs/topics/decorators.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Decorators

Source: https://docs.python.org/3/reference/compound_stmts.html#function-definitions
Source: https://docs.python.org/3.9/reference/compound_stmts.html#function-definitions

This local reference is generated from the official Python documentation and trimmed for pythonlings.
This local reference is generated from the official Python 3.9 documentation and trimmed for pythonlings.

Decorators wrap or transform functions and classes with `@decorator` syntax.

Expand All @@ -15,7 +15,7 @@ The standard type hierarchy):

```python

funcdef: [decorators] "def" funcname [type_params] "(" [parameter_list] ")"
funcdef: [decorators] "def" funcname "(" [parameter_list] ")"
["->" expression] ":" suite
decorators: decorator+
decorator: "@" assignment_expression NEWLINE
Expand Down Expand Up @@ -51,7 +51,7 @@ bound to the function name instead of the function object. Multiple decorators

## More reference

Source: https://docs.python.org/3/library/functools.html#functools.wraps
Source: https://docs.python.org/3.9/library/functools.html#functools.wraps

`functools.wraps` preserves the wrapped function's metadata.

Expand Down
8 changes: 4 additions & 4 deletions pythonlings/docs/topics/functions.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Functions

Source: https://docs.python.org/3/tutorial/controlflow.html#defining-functions
Source: https://docs.python.org/3.9/tutorial/controlflow.html#defining-functions

This local reference is generated from the official Python documentation and trimmed for pythonlings.
This local reference is generated from the official Python 3.9 documentation and trimmed for pythonlings.

`def` creates reusable behavior with parameters, return values, and optional defaults.

Expand Down Expand Up @@ -51,7 +51,7 @@ variables, named in a `global` statement, or, for variables of enclosing

## More reference

Source: https://docs.python.org/3/reference/compound_stmts.html#function-definitions
Source: https://docs.python.org/3.9/reference/compound_stmts.html#function-definitions

Function definition syntax including parameters, annotations, and decorators.

Expand All @@ -62,7 +62,7 @@ The standard type hierarchy):

```python

funcdef: [decorators] "def" funcname [type_params] "(" [parameter_list] ")"
funcdef: [decorators] "def" funcname "(" [parameter_list] ")"
["->" expression] ":" suite
decorators: decorator+
decorator: "@" assignment_expression NEWLINE
Expand Down
Loading