Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for statement (0.16 sec)

  1. docs/en/docs/tutorial/dependencies/dependencies-with-yield.md

    Only the code prior to and including the `yield` statement is executed before creating a response:
    
    ```Python hl_lines="2-4"
    {!../../../docs_src/dependencies/tutorial007.py!}
    ```
    
    The yielded value is what is injected into *path operations* and other dependencies:
    
    ```Python hl_lines="4"
    {!../../../docs_src/dependencies/tutorial007.py!}
    ```
    
    The code following the `yield` statement is executed after the response has been delivered:
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 14.1K bytes
    - Viewed (0)
  2. docs/en/docs/advanced/custom-response.md

    ```{ .python .annotate hl_lines="2  10-12  14" }
    {!../../../docs_src/custom_response/tutorial008.py!}
    ```
    
    1. This is the generator function. It's a "generator function" because it contains `yield` statements inside.
    2. By using a `with` block, we make sure that the file-like object is closed after the generator function is done. So, after it finishes sending the response.
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 11.7K bytes
    - Viewed (0)
Back to top