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 — gh-102936: typing: document performance pitfalls of protocols decorated with `@runtime_checkable` by AlexWaygood · Pull Request #102937 · python/cpython Conversation
|
|
|
||
| assert isinstance(open('/some/file'), Closable) | ||
|
|
||
| @runtime_checkable |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think many users aren't too familiar with OSError's constructor / we can't use kwargs and it's unclear what the second argument is. Maybe we could use int and HasNumerator instead?
(I know it's not writeable, but OSError's errno also is maybe not writeable? Writing to errno doesn't affect repr)
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.
Yeah, I was really struggling to think of a good example for this! I'll ponder some more and see if I can come up with something better...
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.
Perhaps unsurprisingly, not too many good cases of writeable attributes in stdlib. Maybe Thread.name? It's explicitly documented as something you can write to.
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.
That works! I'll make the change tomorrow (it's late here)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Thanks @AlexWaygood for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…ecorated with `@runtime_checkable` (pythonGH-102937) (cherry picked from commit 58d2b30) Co-authored-by: Alex Waygood <[email protected]>
|
GH-102963 is a backport of this pull request to the 3.11 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…ecorated with `@runtime_checkable` (pythonGH-102937) (cherry picked from commit 58d2b30) Co-authored-by: Alex Waygood <[email protected]>
|
GH-102964 is a backport of this pull request to the 3.10 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks all for the reviews! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…ed with `@runtime_checkable` (GH-102937) (cherry picked from commit 58d2b30) Co-authored-by: Alex Waygood <[email protected]>
…ed with `@runtime_checkable` (GH-102937) (cherry picked from commit 58d2b30) Co-authored-by: Alex Waygood <[email protected]>
…ecorated with `@runtime_checkable` (python#102937)
…ecorated with `@runtime_checkable` (python#102937)
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.