I don't really like types on the function declaration line.
Instead of this:
def check_permission(user: User, perm: str, obj: BaseModel | None) -> bool:
I find it much nicer to read something this: """
Check if user is allowed to drive a car
:user: User # The application's User model
:perm: str # Our magic permission string. Tab seperated.
:obj : Basemodel | None # Base model of all our objects since 2017
:returns bool # True if the user is allowed to drive
"""
def check_permission(user, perm, obj):
This way I can grok the code much faster and only have to look into the type declaration when I want to. Due to syntax highlighting, it will look really nice. Because the whole type part can be styled in a dimmer color which puts it into the background. And I can define a key combo to show/hide the whole type part.