Skip to content

Dot notation question #10

@badlydrawnrob

Description

@badlydrawnrob

@Youngestdev Hi there, I'm working my way through your book and enjoying it so far, but I have a simple question about the syntax (it's been a long time since I've used Python) ... by default item = {"id": 1} dictionary can only be accessed using item["id"] syntax, yet the examples in the book use dot notation (item.id).

  1. Are we accessing raw json here?
  2. Or is there something special that FastApi is doing in the background:

I'm assuming our data in chapter 02 is using the todo_list (a list of ToDo dictionaries) and converting requests from json to dict (which we're accessing).

I can't seem to find this information anywhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions