3 ms·
The opening line: >Don’t use Python’s hasattr() unless you want its quirks or are writing Python 3-only code. At this point, you should be writing Python 3-on
by Sir_Cmpwn 11y ago
The opening line:
>Don’t use Python’s hasattr() unless you want its quirks or are writing Python 3-only code.
At this point, you should be writing Python 3-only code. Maybe I should write a post, "Python 2 considered harmful".
- the_mitsuhiko 11y agoIt's a stupid function either way. As it invokes a potentially expensive descriptor just to throw away the result. Silent getattr and check is always more appropriate.
- andrea_s 11y agoWrecking any hope of retrocompatibility considered harmful (who could have known?)
- joslin01 11y agoYou should so it can give us a reason to discuss Python and how it's probably not going anywhere with its crazy versioning and how 2020 will probably never happen and people will still be using Python 2 and Guido will have to fly from the sky and hit us every time we use Python 2 in order for us to upgrade. I love those comment threads.
- deleted 11y ago[deleted]
- Grue3 11y ago>At this point, you should be writing Python 3-only code. At this point it should be obvious that Python 2 will never die. It's Good Enough (TM). Most users will never switch to Py3 because cost outweighs the benefits.
- rbanffy 11y agoThere will be a time every civilized OS will default to Python 3. In fact, the next Ubuntu does so. For us, that time is next March. There is less and less reason to write code in Python 2. Not many libraries require it.
- Herald_MJ 11y agoFull time, career Python developer here. Never worked on a project as part of my day job which is built on Python 3. Recently, for the first time ever, there are projects in the company I work for which are built in Python 3. But I'm still yet to work on them.