Skip to content

Use more pythonic string format #5

@yobuntu

Description

@yobuntu
  • Rentomatic version: latest
  • Python version: all
  • Operating System: all

Description

Tank you a lot for this book, it is a great source of inspiration and make the exact bridge i was missing between clean architecture and working with a web framework and ORM.

That being said, i think you may use the string format in a more pythonic (and expressive) way like this:

setup = {
    "dbname": "rentomaticdb",
    "user": "rentomatic",
    "host": "localhost",
}

conn_str = "postgresql+psycopg2://{user}@{host}/{dbname}".format(**setup)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions