Movatterモバイル変換
[0]ホーム
[Python-Dev] Removing PendingDeprecationWarning
Victor Stinnervstinner at redhat.com
Fri Mar 22 04:41:35 EDT 2019
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.Sure.Let me elaborate my point of view on deprecation, since we arediscussing it here (and I know that my opinion is not fully shared byall core devs, according to the bpo-35283 discussion, or maybe I'mwrong?) :-)Methods of threading.Thread changed their names to comply to PEP 8coding style in Python 3: isAlive() has been renamed to is_alive().The Threading.isAlive() method still exists in Python 3.8 and I thinkthat it's ok. Removing it immediately would go against the bestpractice of writing a single code base working on Python 2 andPython3... 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 someoneconsidered that the alias had to go away from the stdlib.Last December, Serhiy started to talk about removing isAlive(): "It isnot even documented in Python 3, and can be removed in future."https://bugs.python.org/issue35283#msg330242Antoine Pitrou suggested that "If it's not already deprecated, I'd saydeprecate it first." And it has been done.I'm fine with deprecating things, since it doesn't prevent anapplication to be used. Use python3 -Wd (or python3 -X dev) to seethese warnings if you want to be pedantic, but honestly, keeping thealias doesn't hurt anyone. Again, I mostly care about the maintenancecost: isAlive() is not documented, it's just 8 lines in threading.pyand 2 lines in test_threading.py, and it's no like these lines requirea lot of maintenance.IMHO the main metric should be to compare to cost to maintain suchalias vs the pain affecting *all* Python users if we remove it.Right now, the maintenance cost is close to zero, whereas removing thealias would annoy a lot of people who will suddenly no longer be ableto use their legacy code (written for Python 2 long time ago, but onlyported to Python 3 recently). Getting a hard AttributeError exceptionis 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 Pythonis way too big and is expensive to maintain. But we should carefullydiscuss *each* feature removal, and plan properly a slow deprecationperiod to make sure that users had enough time to upgrade (and maybeextend it if needed).For Threading.isAlive(), IMHO the fact that Python 2 is still alive issimply a strong blocker issue. Let's discuss that that Python 2 usagewill be closer to 0,1% than 50% :-) (Sorry, I don't think that it'sreally useful to discuss if Python 2 usage is more around 10% or 70%,that's not really the point: I made up "50%" :-))Victor-- Night gathers, and now my watch begins. It shall not end until my death.
More information about the Python-Devmailing list
[8]ページ先頭