GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||
GeezerVison is showing github.com — bpo-46752: Uniform TaskGroup.__repr__ by asvetlov · Pull Request #31409 · python/cpython Conversation
|
| info_str = ' ' + ' '.join(info) | ||
| return f'<TaskGroup{info_str}>' |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
| info_str = ' ' + ' '.join(info) | |
| return f'<TaskGroup{info_str}>' | |
| info_str = ' '.join(info) | |
| return f'<TaskGroup {info_str}>' |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
After applying the suggestion, a repr for created TaskGroup before __enter__() is called will be "<TaskGroup >" (note the space after class name).
Is it ok? Should we care about this rare case?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
IMO accumulating strings in [] isn't a great pattern unless you have to use it for performance reasons. /my2c.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
After applying the suggestion, a repr for created TaskGroup before
__enter__()is called will be"<TaskGroup >"(note the space after class name). Is it ok? Should we care about this rare case?
The original code has the same issue AFAICT. If you don't want that you could initialize info = [''] perhaps?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
IMO accumulating strings in
[]isn't a great pattern unless you have to use it for performance reasons. /my2c.
Meh. IIRC the info pattern is used all over asyncio (e.g. _task_repr_info in base_tasks.py).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
info = [''] is clever, applied.
Yes, info list is used by other asyncio repr's. I'd like to have the similar approach across the library.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Oops, I've mentioned the problem ': vs =' problem but didn't actually resolve it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@gvanrossum do you want tests for |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
No need for tests. Maybe a new contributor will add them. :-)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.