# PendingDeprecationWarning is really useful?

**URL:** <https://discuss.python.org/t/pendingdeprecationwarning-is-really-useful/1038>\
**Category:** Ideas\
**Created:** [March 19, 2019, 8:16am UTC](https://discuss.python.org/t/pendingdeprecationwarning-is-really-useful/1038 "2019-03-19T08:16:04Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![brettcannon](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/brettcannon/32/34895_2.png) [@brettcannon](https://discuss.python.org/u/brettcannon)\
**Post date:** [March 21, 2019, 7:00pm UTC](https://discuss.python.org/t/pendingdeprecationwarning-is-really-useful/1038/18 "2019-03-21T19:00:42Z")

</div>

Just so people know what I have thought about, I’ve contemplated adding the following to `warnings`:

```python
def _deprecate(message, *, remove, start=None, stacklevel=2):
    """Deprecate starting in the Python version 'start' and remove in 'remove'.

    Both 'start' and 'remove' are two-item tuples representing a (major, minor)
    version of Python. If 'start' is specified, then the >N-1 version of 'remove'
    will raise PendingDeprecationWarning, otherwise DeprecationWarning is
    raised for >N of 'remove'. When the Python version <= 'remove' then XXX.
    """

```

I don’t know if some other warning should be raised once `remove` is reached or raise an exception.

I’m also tempted to provide a way to have a template message for the warning since most are of the form `f"{name} has been deprecated since {start} and is slated for removal in {remove}; use {alternative} instead"` (with obvious tweaks based on what is provided in the function call).

---

_[View the full topic](https://discuss.python.org/t/pendingdeprecationwarning-is-really-useful/1038)._
