[Python-Dev] Removing PendingDeprecationWarning
Le ven. 22 mars 2019 ? 09:16, Inada Naoki <songofacandy at gmail.com> a ?crit :
> > > We have `socket.error` for long time.
> > And it's perfectly fine, no?
> Yes. Waiting 10+ years to remove aliases is fine.
Let me elaborate my point of view on deprecation, since we are
discussing it here (and I know that my opinion is not fully shared by
all core devs, according to the bpo-35283 discussion, or maybe I'm
Methods of threading.Thread changed their names to comply to PEP 8
coding style in Python 3: isAlive() has been renamed to is_alive().
The Threading.isAlive() method still exists in Python 3.8 and I think
that it's ok. Removing it immediately would go against the best
practice of writing a single code base working on Python 2 and
Python3... I would be very annoyed to have to replace a simple
"thread.isAlive()" call with something like
"six.threading_is_alive(thread)" in my code, just because someone
considered that the alias had to go away from the stdlib.
Last December, Serhiy started to talk about removing isAlive(): "It is
not even documented in Python 3, and can be removed in future."
Antoine Pitrou suggested that "If it's not already deprecated, I'd say
deprecate it first." And it has been done.
I'm fine with deprecating things, since it doesn't prevent an
application to be used. Use python3 -Wd (or python3 -X dev) to see
these warnings if you want to be pedantic, but honestly, keeping the
alias doesn't hurt anyone. Again, I mostly care about the maintenance
cost: isAlive() is not documented, it's just 8 lines in threading.py
and 2 lines in test_threading.py, and it's no like these lines require
a lot of maintenance.
IMHO the main metric should be to compare to cost to maintain such
alias vs the pain affecting *all* Python users if we remove it.
Right now, the maintenance cost is close to zero, whereas removing the
alias would annoy a lot of people who will suddenly no longer be able
to use their legacy code (written for Python 2 long time ago, but only
ported to Python 3 recently). Getting a hard AttributeError exception
is different than getting a silent DeprecationWarning :-)
Wait, I'm not against removing things from Python. Don't tell anyone,
but I *love* removing code, that's my greatest pleasure! IMHO Python
is way too big and is expensive to maintain. But we should carefully
discuss *each* feature removal, and plan properly a slow deprecation
period to make sure that users had enough time to upgrade (and maybe
extend it if needed).
For Threading.isAlive(), IMHO the fact that Python 2 is still alive is
simply a strong blocker issue. Let's discuss that that Python 2 usage
will be closer to 0,1% than 50% :-) (Sorry, I don't think that it's
really useful to discuss if Python 2 usage is more around 10% or 70%,
that's not really the point: I made up "50%" :-))
Night gathers, and now my watch begins. It shall not end until my death.