Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Why not use the return type annotation for the response_model? #101

Closed
@JHSaunders

Description

@JHSaunders

Description

This is a very minor question on chosen syntax. Why not use the return type annotation for the response_model? For example rather than:

@app.post("/items/",response_model=Item)asyncdefcreate_item(*,item:Item):returnitem

You could concievably go:

@app.post("/items/")asyncdefcreate_item(*,item:Item)->Item:returnitem

which just seems like it uses the language facilities better and is a bit more pythonic. There is no real change in feature set, and I am sure i was thought of, but what was the reasoning behind not doing it?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2026 Movatter.jp