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-104003: Implement PEP 702 by JelleZijlstra · Pull Request #104004 · python/cpython Conversation
|
|
This is copied from python/typing_extensions#105. |
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 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.
LGTM.
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.
Waiting for the other reviewers to pipe in? This seems pretty straightforward.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The PEP hasn't been accepted yet! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Planning to hit the merge button the moment the PEP is accepted :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
PEP 702 has been accepted, but it's changed since this PR. I'll update the PR soon to put the decorator in |
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 an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-authored-by: Hugo van Kemenade <[email protected]>
There was an error while loading. Please reload this page.
It's already sorta awkwardly overloaded in what it means tbh — the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
A class seems somewhat more elegant to me, but yeah, that would work. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'm OK with making it a class. It's not what the object is meant for, but it's a reasonable extension. Using |
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 an error while loading. Please reload this page.
| * The new :func:`warnings.deprecated` decorator provides a way to communicate | ||
| deprecations to :term:`static type checkers <static type checker>` and | ||
| to warn on usage of deprecated classes and functions. |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Despite static typing being the original motivation for the feature, I would actually put the runtime effect first here:
| * The new :func:`warnings.deprecated` decorator provides a way to communicate | |
| deprecations to :term:`static type checkers <static type checker>` and | |
| to warn on usage of deprecated classes and functions. | |
| * The new :func:`warnings.deprecated` decorator provides an ergonomic way to | |
| mark a class or function as deprecated. A deprecation warning will be | |
| emitted whenever a decorated function or class is used at runtime. The | |
| decorator is also understood by | |
| :term:`static type checkers <static type checker>`, which will emit warnings | |
| if they identify a decorated function or class being used. |
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.
I still want to put the type checker effect first because that's the unique part. You can write a decorator that generates runtime warnings yourself; the new and exciting part is that this decorator is also understood by static type checkers.
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.
You can do, sure, but do people? It was possible to reimplement itertools.batched in a few lines of code before Python 3.12, but lots of people were still very excited by its inclusion in the stdlib in Python 3.12.
I think this new decorator here could prove pretty popular with people who don't use static typing! But, I don't feel strongly; it looks fine to me now :)
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.
Sure, there are lots of third-party deprecation decorators. The Deprecated library, I think Flask has one internally (David Lord mentioned it in PEP 702 discussions), I know at Quora we have one internally.
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.
I'm not sure if that's meant to be a point in agreement or in disagreement with the point I'm making that this decorator could prove pretty popular with people who don't use static typing. Anyway, as I say, I'm happy with the docs now!
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 an error while loading. Please reload this page.
|
Thanks @AlexWaygood for the review! I pushed some changes. |
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 an error while loading. Please reload this page.
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.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-authored-by: Alex Waygood <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Alex Waygood <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Alex Waygood <[email protected]>
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.