-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introspection. #1949
Introspection. #1949
Conversation
@@ -0,0 +1,13 @@ | |||
async def get_uri(app): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this fn named get_uri
(singular) but returns 'uris'
(plural)?
@@ -0,0 +1,13 @@ | |||
async def get_uri(app): | |||
return {'uris': app.router.routes_all} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why return a dict? Shouldn't it be return app.router.routes_all
?
'named_request': app.named_request_middleware, | ||
'named_response': app.named_response_middleware } | ||
|
||
return {'middlewares': middlewares} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why return a dict? Shouldn't it be return middlewares
?
Hi @tomaszdrozdz Overall, I'm struggling to see how this would be useful or helpful.
when you can already simply do:
The second option is faster to execute, one fewer lines, and easier to read and understand. Similarly, why would a user want to do:
when you can already simply do:
Again, thats faster to execute, fewer lines, and easier to read and understand. |
Thank You for comments. Your comments about returning dicts, ... are right. Or maybe in this case adding documentation that would explain how to do it would be enough ? |
And off course for end user it would be as easy as:
Just what do You think about this idea, or do You prefer perhaps some documentation section like "introspection" ? |
It sounds more like a documentation issue. |
I think that kind of "tools" would be nice to have in core functionality.
Now two simple, but maybe some day we can have more.
If this is bad idea to have such tools in core functionality please share with me why.